Delphi-PRAXiS

Delphi-PRAXiS (https://www.delphipraxis.net/forum.php)
-   Netzwerke (https://www.delphipraxis.net/14-netzwerke/)
-   -   Delphi XE 7 & Indy - Emails mit Anhang funktioniert nicht... (https://www.delphipraxis.net/183990-delphi-xe-7-indy-emails-mit-anhang-funktioniert-nicht.html)

Supergrobie 18. Feb 2015 11:34

Delphi XE 7 & Indy - Emails mit Anhang funktioniert nicht...
 
Hallo Zusammen...

Ich versuche jetzt seit ein paar Stunden XE7 mit Indy 10 dazu zu bringen die Attachments nicht mehr
als Text an die Mail anzuhängen.
Im Netz findet man zu unterschiedlichen Delphi & Indy Versionen die unterschiedlichsten Ansätze.
Habe so alles durchprobiert :roll:

Hier erst mal die mail die ankommt...:

Code:
Content-Type: multipart/*; boundary="nU8GnuuzsdwgEAf3=_WZNLG0CuPaShqv7J"
MIME-Version: 1.0
Date: Wed, 18 Feb 2015 12:05:47 +0100
X-Antivirus: avast! (VPS 141107-0, 07.11.2014), Outbound message
X-Antivirus-Status: Clean

This is a multi-part message in MIME format

--nU8GnuuzsdwgEAf3=_WZNLG0CuPaShqv7J
Content-Type: text/plain
Content-Transfer-Encoding: quoted-printable
Content-Disposition: inline

siehe Anhang

--nU8GnuuzsdwgEAf3=_WZNLG0CuPaShqv7J
Content-Type: application/zip;
      name="Erheb_150218.xls"
Content-Transfer-Encoding: base64
Content-Disposition: attachment;
      filename="Erheb_150218.xls"

0M8R4KGxGuEAAAAAAAAAAAAAAAAAAAAAPgADAP7/CQAGAAAAAAAAAAAAAAABAAAAAQAAAAAAAAAA
EAAAAgAAAAEAAAD+////AAAAAAAAAAD/////////////////////////////////////////////
Der Code dazu sieht so aus:

Code:
    sMTP := TIdSMTP.Create(nil);
    SMTP.Host := sMailacountDomain;
    SMTP.Port := 25;
    SMTP.AuthType := satDefault;
    SMTP.Username := sMailacountUserId;
    SMTP.Password := sMailacountPassword;
    SMTP.Connect(sMailacountDomain);
    if SMTP.Authenticate then
    begin
      try
       MailMessage := TIdMessage.Create(nil);
       MailMessage.From.Name := sMessageFrom;
       MailMessage.From.Address := sMessageFrom;
       MailMessage.Subject := sMessageSubject;
       if sMessageBody = '' then
          sMessageBody := 'siehe Anhang';

       MailMessage.Body.Add(sMessageBody);
       MailMessage.ContentType := 'multipart/*';
       MailMessage.AttachmentEncoding := 'MIME';
       MailMessage.Encoding := meMIME;

       IdEmailAddressItem.Address := sMessageTo;

       MailMessage.IsEncoded:=true;
       anhangF := TIdAttachmentFile.Create(MailMessage.MessageParts);
       anhangF.ContentType := 'application/zip';
       anhangF.StoredPathName := slMessageAttachments[0];
       anhangF.FileName := ExtractFileName(slMessageAttachments[0]);
       anhangF.OpenLoadStream;
       anhangF.CloseLoadStream;

       SMTP.Send(MailMessage);
Hat jemand das gleich Problem und eine Lösung dafür???
Für Tips wäre ich dankbar...!

Gruss
Stevie

mber 18. Feb 2015 15:02

AW: Delphi XE 7 & Indy - Emails mit Anhang funktioniert nicht...
 
Hallo Stevie,

das Problem kenne ich, darüber bin ich vor kurzem auch gestolpert.
Versuch mal MailMessage.Encoding:=mePlainText;
Wenn es auf default oder mime steht hatte ich das von dir beschriebene Problem.

Viele Grüße
Matthias


Alle Zeitangaben in WEZ +1. Es ist jetzt 05:19 Uhr.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
LinkBacks Enabled by vBSEO © 2011, Crawlability, Inc.
Delphi-PRAXiS (c) 2002 - 2023 by Daniel R. Wolf, 2024 by Thomas Breitkreuz