procedure Tfrm_POP3SMTPTester.btn_SendMailClick(Sender: TObject);
var
m: TIdMessage;
begin
try
if IdSMTP1.Connected
then
IdSMTP1.Disconnect;
IdSMTP1.Port := StrToInt(edt_SMTPPort.Text);
IdSMTP1.Host := edt_SMTPHost.Text;
IdSMTP1.Username := edt_SMTPUser.Text;
IdSMTP1.Password := edt_SMTPPassWort.Text;
if chkb_Auth.Checked
then
begin
IdSMTP1.Authenticate;
end;
IdSMTP1.Connect;
if IdSMTP1.Connected
then
begin
m := TIdMessage.Create(self);
m.From.Text := edt_from.Text;
m.Recipients.Add.Text := edt_to.Text;
m.Subject := '
TestMail from SMTP Checker';
m.Body.Text := '
Dieses Mail wurde zu Testzwecken versendet';
IdSMTP1.Send(m);
IdSMTP1.Disconnect;
showmessage('
Das Mail wurde erfolgreich versendet!');
end;
except
on E: EIdTextInvalidCount
do
Writeln(E.
Message);
on E: EIdMessageCannotLoad
do
Writeln(E.
Message);
on E: EIdPOP3Exception
do
Writeln(E.
Message);
on E: EIdTextInvalidCount
do
Writeln(E.
Message);
on E: EIdMessageCannotLoad
do
Writeln(E.
Message);
on E: EIdDoesNotSupportAPOP
do
Writeln(E.
Message);
on E: EIdUnrecognizedReply
do
Writeln(E.
Message);
on E: EIdTLSClientException
do
Writeln(E.
Message);
on E: EIdTLSClientSSLIOHandlerRequred
do
Writeln(E.
Message);
on E: EIdTLSClientCanNotSetWhileConnected
do
Writeln(E.
Message);
on E: EIdTLSClientTLSNotAvailable
do
Writeln(E.
Message);
on E: EIdTLSClientTLSNegCmdFailed
do
Writeln(E.
Message);
on E: EIdTLSClientTLSHandShakeFailed
do
Writeln(E.
Message);
on E: EIdTLSServerException
do
Writeln(E.
Message);
on E: EIdTLSClientCanNotSetWhileActive
do
Writeln(E.
Message);
end;
if IdSMTP1.Connected
then
IdSMTP1.Disconnect;
end;
Danke für weitere Tipps.