Hallo,
ich habe eine Funktion geschrieben, die mit Hilfe von Tidsmtp und Tidmessage eine Email senden soll an meinen Gmx account. Ich habe hinter die wichtigsten Befehle eine Showmessage anweisung gesetzt um zu sehen bis wohin die function noch abgearbeitet wird, bevor der Fehler auftritt. Bis zur zeile idsmtp1.send funktioniert alles ohne probleme, dann springt delphi zu except weiter...kann mir jemand sagen wo mein Fehler liegt? Alle Account Daten hatte ich richtig eingeben, mehrfach über prüft..
1: 2: 3: 4: 5: 6: 7: 8: 9: 10: 11: 12: 13: 14: 15: 16: 17: 18: 19: 20: 21: 22: 23: 24: 25: 26: 27: 28: 29: 30: 31: 32: 33: 34: 35: 36: 37: 38: 39: 40: 41: 42: 43: 44: 45: 46: 47: 48: 49: 50: 51: 52: 53: 54: 55: 56: 57: 58: 59: 60: 61:
| Function Emailsenden: Boolean;
begin try idsmtp1 := Tidsmtp.create (nil); idmessage1 := Tidmessage.create (nil);
idsmtp1.host := 'mail.gmx.net'; idsmtp1.port := 25; idsmtp1.Username := ('xxx'); idsmtp1.password := 'xxxxx'; idsmtp1.AuthenticationType := atlogin;
try idsmtp1.connect (10000); IdSMTP1.Authenticate; showmessage ('Verbindung ok'); With Idmessage1 do begin clear;
Subject := ('test'); // Absender Adresse Showmessage ('subject'); From.Address := ('XXXXX'); // Name des Absenders Showmessage ('fromaddr'); From.text := ('XXX'); // Betreff Showmessage ('fromname'); Recipients.EMailAddresses := ('XXXXXX'); // Empfänger Adresse Priority := mpNormal; //E-Mail-Adressen der Kopie-Empfänger (CC=Carbon Copy) CCList.EMailAddresses := (''); //E-Mail-Adressen der versteckten Kopie-Empfänger (BCC=Blind Carbon Copy) BccList.EMailAddresses := (''); idmessage1.Body.Text := ('test'); Showmessage ('toadr');
Showmessage ('addto');
idsmtp1.Send (idmessage1); Showmessage ('send'); Showmessage ('Email gesendet'); Result := true; idsmtp1.disconnect; end; except showmessage ('Keine Verbindung'); Result := False; idsmtp1.disconnect; end; finally idsmtp1.destroy; idmessage1.destroy; end;
end; |