ohne SSL wird es wohl bei Strato nicht funktionieren.
procedure TfeMailKonto.bTestClick(Sender: TObject);
var
smtp : TIdSMTP;
Msg: TIdMessage;
begin
screen.Cursor := crHourGlass;
smtp := TIdSMTP.Create(nil);
msg := TIdMessage.Create();
try
try
Msg.From.Address:= eEmail.Text;
Msg.Recipients.EMailAddresses:= eEmail.Text;
Msg.Subject := 'Test eMail';
Msg.ReceiptRecipient.Text := eEmail.Text;
if eBCC.Text <> '' then
Msg.BCCList.Add.Text := eBCC.Text;
with TIdText.Create(msg.MessageParts) do begin
Body.Add('Test eMail');
ContentType := 'text/
html; charset=utf-8;';
end; // with
SMTP.Host:= eSMTP.Text;
SMTP.Username:= eKontoname.Text;
SMTP.Password := ePasswort.Text;
SMTP.Port := strtoint(eSMTPPort.Text);
SMTP.IOHandler := indySSL;
SMTP.USETLS := TIdUseTLS(cbTLS.ItemIndex);
SMTP.ConnectTimeout := 1000;
try
SMTP.Connect();
SMTP.Authenticate;
SMTP.Send(Msg);
showMessage('eMail erfolgreich versendet');
finally
SMTP.Disconnect;
end; // try
except on E:
Exception do
showMessage(E.Message);
end; // try
finally
msg.Free;
smtp.Free;
screen.Cursor := crDefault;
end; // try
end;