Autor Beitrag
Gagga
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starontopic star
Beiträge: 95

Win 11
Delphi 12 Athen Pro
BeitragVerfasst: So 10.05.20 22:36 
Hallo!

Aus meiner Anwendung sollen E-Mails verschickt werden können. Ich nutze dafür die INDY-Komponenten IdSMTP und IdMessage. Ich bin soweit, dass alternativ E-Mails im Text-Format und im Html-Format versendet werden können. Im Text-Format klappt es auch mit Anlagen. Da muss beim ContentType der IdMessage keine Änderung vorgenommen werden.

Bei der Html-Mail mit Anlagen beiße ich mir die Zähne aus. Sicher ist, dass 'text/html' als ContentTyp geändert werden muss, da die Anlage andernfalls als Binärcode im Text ankommt. Aber 'multipart/mixed' oder 'multipart/*' oder 'multipart/html' lässt die E-Mail im Html-Quelltext mit Anlage ankommen.

Die Anlagen füge ich wie folgt an:
ausblenden Delphi-Quelltext
1:
2:
for a := 0 to ListAnlagen.Items.Count-1 do
  TIdAttachmentFile.Create(IdMessage1.MessageParts, ListAnlagen.Items[a]);

Muss ich noch `was mit den IdMessage1.MessageParts anstellen?

Gruß
Gagga
mandras
ontopic starontopic starontopic starontopic starontopic starontopic starofftopic starofftopic star
Beiträge: 429
Erhaltene Danke: 107

Win 10
Delphi 6 Prof, Delphi 10.4 Prof
BeitragVerfasst: Mo 11.05.20 11:33 
für allgemeine Dateien wäre application/octet-stream gut,
wenn klar ist worum es sich handelt kann man das auch angeben
zB mittels application/pdf für PDF-Dateien.
Gagga Threadstarter
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starontopic star
Beiträge: 95

Win 11
Delphi 12 Athen Pro
BeitragVerfasst: Mo 11.05.20 11:58 
Verschicke ich eine Html-Mail mit Anlage mit "application/octet-stream" für IdMessage1.ContentType, kommt eine leere E-Mail mit einer Anlage an, die als "Teilstück 1" ohne Dateiendung bezeichnet ist. Geöffnet mit einem Editor sieht man im Teilstück 1 den Html-Quelltext und die Anlage im Binär-Code.

Mit "application/pdf" lässt sich ein PDF als Anlage verschicken, vom Text kommt allerdings gar nichts an.

Gruß
Gagga

Moderiert von user profile iconTh69: Delphi-Tags hinzugefügt
Th69
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starontopic star
Moderator
Beiträge: 4764
Erhaltene Danke: 1052

Win10
C#, C++ (VS 2017/19/22)
BeitragVerfasst: Mo 11.05.20 13:29 
Haben denn die einzelnen MessageParts jeweils den korrekten ContentType? Wie in dem Link How do you send HTML messages with Indy? (den ich dir in deinem ersten Thema schon gegeben habe) - unter "HTML and non-related attachments and no plain-text".
Gagga Threadstarter
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starontopic star
Beiträge: 95

Win 11
Delphi 12 Athen Pro
BeitragVerfasst: Mo 11.05.20 13:34 
Also doch komplizierter.

Ich hoffte mit diesen hier (www.tech-ecke.de/ind...ente_indy_email.htm) beschriebenen Einstellungen klarzukommen.

Dann muss ich wohl doch...

Gruß
Gagga
Gagga Threadstarter
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starontopic star
Beiträge: 95

Win 11
Delphi 12 Athen Pro
BeitragVerfasst: Di 12.05.20 17:30 
Ich habe es hinbekommen. Übrigens konnte ich mir den ContentType für die TIdAttachmentFile.Create(IdMessage1.MessageParts,Anlage) sparen. Die IdMessage1 nahm alles klaglos an und trug es zum Empfänger.

Ich danke Euch!

Gruß
Gagga

Moderiert von user profile iconTh69: Delphi-Tags hinzugefügt