Hallo ihr alle,
ich hab ein kleines e-mail programm mit den Indy Komponenten idSMTP, IdMessage gebastelt. Es funktioniert auch soweit. Allerdings hab ich noch ein keines Problem.
Und zwar:
Wie kann ich eine Exceptionbehandlung auslösen, wenn meine Userdaten zum verbinden zum Server falsch sind. Beispielsweise, das wenn ich mein Passwort falsch eingetippt habe eine Message kommt.
Zur Zeit siehts bei mir so aus.
Delphi-Quelltext
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:
| begin IdSMTP1.AuthenticationType := atLogin; IdSMTP1.Host := host; IdSMTP1.UserName := userID; IdSMTP1.Password := passwort; IdSMTP1.Port := 25; IdMessage1.From.text := absmail; IdMessage1.Sender.text := IdMessage1.From.text; IdMessage1.Recipients.EMailAddresses := Recipient; IdMessage1.CCList.EMailAddresses := CCList; IdMessage1.Subject := sSubject; IdMessage1.Body.Clear; IdMessage1.Body := Body; try IdSMTP1.Connect; IdSMTP1.Send(IdMessage1); IdSMTP1.Disconnect; result := true; except on E : Exception do begin if IdSMTP1.connected then try IdSMTP1.disconnect; except end; result := false; end;
end; |
Kann mir bitte jemand helfen. Vielleicht hat jemand nen nützlichen Code.
Danke