try
IdMessage.MessageParts.Clear;
IdMessage.Date := Now;
// IdMessage.CharSet := 'ISO-8859-1';
IdMessage.CharSet := CbCharSet.Text;
IdMessage.ContentType := '
multipart/related + multipart/mixed + text/plain ' +
'
+ text/html + multipart/alternative + application/pdf ';
IdMessage.AttachmentTempDirectory := SysUtils.GetEnvironmentVariable('
temp');
SL := TStringList.Create;
SL.Text := HTMLText;
MailText := betreff;
with TIdMessageBuilderHtml.Create
do
begin
try
// Wenn HTML Mail ist
if frmEinstellungen.cbHTML.Checked = True
then
begin
html.Text := SL.Text;
end
else // HTML Mails
PlainText.Text := SL.Text;
// Ende Images herausfinden
// Normale Anhänge hinzufügen
if FileExists(xAnhang)
then
Attachments.Add(xAnhang);
if FileExists(frmHaupt.xFileName1)
then
Attachments.Add(frmHaupt.xFileName1);
if FileExists(frmHaupt.xFileName2)
then
Attachments.Add(frmHaupt.xFileName2);
if FileExists(frmHaupt.xFileName3)
then
Attachments.Add(frmHaupt.xFileName3);
if FileExists(frmHaupt.xFileName4)
then
Attachments.Add(frmHaupt.xFileName4);
if FileExists(frmHaupt.xFileName5)
then
Attachments.Add(frmHaupt.xFileName5);
// Ende Normale Anhänge
FillMessage(IdMessage);
finally
Free;
end;
end;
IdMessage.Subject := MailText;
IdMessage.From.Address := frmSetup.Email.Text;
IdMessage.From.
Name := EdName.Text;
if EdReplayTo.Text <> '
'
then
IdMessage.ReplyTo.EMailAddresses := EdReplayTo.Text
else
IdMessage.ReplyTo.EMailAddresses := frmSetup.Email.Text;
IdMessage.CharSet := CbCharSet.Text;
IdMessage.Recipients.EMailAddresses := empfaenger;
if BCC <> '
'
then
IdMessage.BccList.EMailAddresses := BCC;
IdSMTP.Host := frmSetup.SMTPServer.Text;
IdSMTP.Username := frmSetup.edtAccount.Text;
IdSMTP.Password := frmSetup.edtPassword.Text;
IdSMTP.Port := StrToInt(frmSetup.SMTPPort.Text);
xAuthCange;
IdSMTP.Connect;
if IdSMTP.Authenticate
then
begin
IdSMTP.Send(IdMessage);
end
else
MessageDlg('
Login fehlerhaft', mtError, [mbOk], 0, mbOk);