Leider funktioniert es nicht bei mir:
Ich erhalte die Debugger-Fehlermeldung:
SMTP-Error: StartTLS: Success-Other or undefined security status
Error in Zeile 83
Code: Alles auswählen
procedure TForm1.MailSend(const sSmtpHost, sSmtpPort, sSmtpUser, sSmtpPasswd, sFrom, sTo, sFileName: AnsiString);
var
smtp: TSMTPSend;
msg_lines: TStringList;
begin
msg_lines := TStringList.Create;
smtp := TSMTPSend.Create;
try
msg_lines.LoadFromFile(sFileName);
msg_lines.Insert(0, 'From: ' + sFrom);
msg_lines.Insert(1, 'To: ' + sTo);
smtp.UserName := sSmtpUser;
smtp.Password := sSmtpPasswd;
smtp.TargetHost := sSmtpHost;
smtp.TargetPort := sSmtpPort;
AddToLog('SMTP Login');
if not smtp.Login() then
raise ESMTP.Create('SMTP ERROR: Login:' + smtp.EnhCodeString);
AddToLog('SMTP StartTLS');
if not smtp.StartTLS() then
raise ESMTP.Create('SMTP ERROR: StartTLS:' + smtp.EnhCodeString); //<- hier taucht die Fehlermeldung auf
AddToLog('SMTP Mail');
if not smtp.MailFrom(sFrom, Length(sFrom)) then
raise ESMTP.Create('SMTP ERROR: MailFrom:' + smtp.EnhCodeString);
if not smtp.MailTo(sTo) then
raise ESMTP.Create('SMTP ERROR: MailTo:' + smtp.EnhCodeString);
if not smtp.MailData(msg_lines) then
raise ESMTP.Create('SMTP ERROR: MailData:' + smtp.EnhCodeString);
AddToLog('SMTP Logout');
if not smtp.Logout() then
raise ESMTP.Create('SMTP ERROR: Logout:' + smtp.EnhCodeString);
AddToLog('OK!');
finally
msg_lines.Free;
smtp.Free;
end;
end;
Zum Testen wird Port 25 für eine unverschlüsselte Übertragung verwendet bei post.strato.de