I am sending an HTML email with an ical invitation attached.
I'm facing the issue that many mail-clients do not show the body of the mail properly.
Thunderbird shows neither the plain-text nor html e-mail body, only the raw invitation
Outlook 2013 seems to show the html-body but totally messed up. Only the raw text contained within the html-mail is shown. CSS seems to be ignored
This issue occurs only if the ical-attachment is present. If I send the same mail without the ical attachment, everything works fine.
Is there maybe some kind of header that tells mail-clients to also show the mail-body in addition to the ical-invitation or what else could I be missing?
Date: Thu, 26 Aug 2021 08:47:10 +0200 (CEST)
From: John Doe <john#doe.com>
To: Max Mustermann <max#mustermann.de>
Subject: =?UTF-8?Q?Best=C3=A4tigung_Ihres_Termins_am_18.08.2020?=
MIME-Version: 1.0
Content-Type: multipart/alternative;
boundary="----=_Part_6_1140395501.1629960429000"
------=_Part_6_1140395501.1629960429000
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: quoted-printable
<... my plain text mail ...>
------=_Part_6_1140395501.1629960429000
Content-Type: text/html; charset=UTF-8
Content-Transfer-Encoding: quoted-printable
<!doctype html>
<... my HTML email ...>
------=_Part_6_1140395501.1629960429000
Content-Type: text/calendar; charset=UTF-8; method=REQUEST
Content-Transfer-Encoding: 7bit
BEGIN:VCALENDAR
PRODID:-//My Company//My App//EN
VERSION:2.0
CALSCALE:GREGORIAN
METHOD:REQUEST
BEGIN:VEVENT
DTSTAMP:20210826T064710Z
UID:38c15e72-12cf-44d1-97ea-a5a753f4b724
SUMMARY:Your Appointment
DESCRIPTION:Passwort: secure123\nhttps://example.com/meeting
LOCATION:Online-Meeting
DTSTART;TZID=Europe/Berlin:20200818T153000
ATTENDEE;PARTSTAT=ACCEPTED;RSVP=FALSE;CN=John Doe;EMAIL=john#doe.com:mailto:john#doe.com
ATTENDEE;PARTSTAT=ACCEPTED;RSVP=FALSE;CN=Max Mustermann;EMAIL=max#mustermann.de:mailto:max#mustermann.de
END:VEVENT
END:VCALENDAR
------=_Part_6_1140395501.1629960429000--
I had a similar problem when sending ical Attachements from Rails and trying to check the resulting mails with MailCatcher.
The problem is the Content-Transfer-Encoding: 7bit (typically used for binary files) but your attachment is more like plain text.
Try to use quoted-printable instead, like in this example:
----==_mimepart_612e500330e6c_dd52137407244b
Content-Type: text/calendar;
charset=UTF-8
Content-Transfer-Encoding: quoted-printable
Content-Disposition: attachment;
filename=A-1105.ics
Content-ID: <612e500337894_dd521374072738#Nielss-MBP.localdomain.mail>
BEGIN:VCALENDAR=0D
CALSCALE:GREGORIAN=0D
PRODID:-//Foxtag//DE=0D
X-WR-TIMEZONE:Europe/Amsterdam=0D
VERSION:2.0=0D
METHOD:PUBLISH=0D
BEGIN:VEVENT=0D
...
In Rails you can set the encoding when adding attachments like this:
attachments['mycalendar.ics'] = {
mime_type: "text/calendar",
encoding: "quoted-printable",
content: #ical_content_as_string
}
Related
I'm trying to create e-mail with multipart/mixed content, with 2 HTML BodyParts (no attachments).
MIME-Version: 1.0
Date: Thu, 9 Dec 2021 13:44:01 +0100
Message-ID: <id#localhost>
Subject: This is Subject
From: test <foo#bar.com>
To: foo2#bar.com
Content-Type: multipart/mixed;
boundary="----main_boundary"
------main_boundary
Content-Type: multipart/alternative;
boundary="----header_boundary"
------header_boundary
Content-Type: text/html
Content-Transfer-Encoding: 7bit
<h2>Header before the main body</h2>
------header_boundary--
------main_boundary
Content-Type: multipart/alternative; boundary=boundary1
Content-Disposition: inline
--boundary1
Content-Type: text/html; charset=utf-8
Content-Transfer-Encoding: quoted-printable
<b>Just HTML</b>
--boundary1--
------main_boundary--
This e-mail renders fine in all clients even mobile ones I've tested except Outlook and Windows Mail. Seems like Microsoft's clients ignore the Second body part and displays only the Header before the main body part.
Is there any workaround? I don't want to create just one html content.
I am trying to send an email using Python. It works when I set a string as a HTML type MIMEText, but it doesn't work with the same string in PLAIN type MIMEText. The string is missing when I open the email. Following is a sample multipart message generated. What could be wrong?
Do I need to indicate that it is a Plain Text email so that email client can interprete it correctly?
Content-Type: multipart/related; boundary="===============3257044665703803104=="
MIME-Version: 1.0
Subject: Hello From DSAID
From:
To:
Reply-to:
=====================================================
--===============3257044665703803104==
Content-Type: multipart/alternative; boundary="===============4011076745108604317=="
MIME-Version: 1.0
--===============4011076745108604317==
Content-Type: text/plain; charset="us-ascii"
MIME-Version: 1.0
Content-Transfer-Encoding: 7bit
Hello, Hello, Are you There?
--===============4011076745108604317==
Content-Type: text/html; charset="us-ascii"
MIME-Version: 1.0
Content-Transfer-Encoding: 7bit
--===============4011076745108604317==--
--===============3257044665703803104==--
I am trying to send an email with an calendar invitation from my system. I am using Nodemailer with AWS SES to send the email. However, when I receive the email, it is not recognized in Outlook or Apple Mail as it normally should. Instead the file is shown as an attachment like below. It works perfectly for Gmail.
My full mime email.
Date: Mon, 18 Nov 2019 21:59:06 +0100
Subject: =?UTF-8?B?TcO4dGU=?= invitasjon
From: Vemund Eldegard <vemund#vemund.dev>
To: Vemund Eldegard <vemundeldegard#gmail.com>
Message-ID: <0102016e804fd836-90cd9a6a-53e9-4a45-978e-44665ed374ca-000000#eu-west-1.amazonses.com>
Thread-Topic: =?UTF-8?B?TcO4dGU=?= invitasjon
Thread-Index: ATBkLTZmODLXtNTivl08U1EZEEpJkw==
Mime-version: 1.0
Content-type: multipart/mixed;
boundary="B_3656959371_1438576101"
> This message is in MIME format. Since your mail reader does not understand
this format, some or all of this message may not be legible.
--B_3656959371_1438576101
Content-type: multipart/alternative;
boundary="B_3656959371_1431796008"
--B_3656959371_1431796008
Content-type: text/plain;
charset="UTF-8"
Content-transfer-encoding: 7bit
hallo!
--B_3656959371_1431796008
Content-type: text/html;
charset="UTF-8"
Content-transfer-encoding: quoted-printable
<html>
<head>
<meta http-equiv=3D"Content-Type" content=3D"text/html; charset=3Dutf-8">
<meta content=3D"text/html; charset=3Diso-8859-1">
</head>
<body>
<p>hallo!</p>
</body>
</html>
--B_3656959371_1431796008--
--B_3656959371_1438576101
Content-type: application/ics; name="invitation.ics";
x-mac-creator="4F50494D"
Content-ID: <88C14204654B324DA95BD8F0C0925135#1>
Content-disposition: attachment;
filename="invitation.ics"
Content-transfer-encoding: base64
QkVHSU46VkNBTEVOREFSDQpWRVJTSU9OOjIuMA0KUFJPRElEOi0vL3NhbGlyZS5uby8vc2Fs
aXJlLy9FTg0KTUVUSE9EOlJFUVVFU1QNCk5BTUU6TXkgVGVzdGZlZWQNClgtV1ItQ0FMTkFN
RTpNeSBUZXN0ZmVlZA0KQkVHSU46VkVWRU5UDQpVSUQ6Zm9vMTIzQHNhbGlyZS5oZXJva3Vh
cHAuY29tDQpTRVFVRU5DRTowDQpEVFNUQU1QOjIwMTkxMTE4VDIwNTkwNloNCkRUU1RBUlQ6
MjAxOTExMThUMjA1OTA2Wg0KRFRFTkQ6MjAxOTExMThUMjE1OTA2Wg0KU1VNTUFSWTpNeSBF
dmVudA0KWC1BTFQtREVTQztGTVRUWVBFPXRleHQvaHRtbDo8Yj5tYXJrPC9iPiB1cCEgaGFo
YWgNCk9SR0FOSVpFUjtDTj0iVmVtdW5kIEVsZGVnYXJkIjtFTUFJTD12ZW11bmRAdmVtdW5k
LmRldjptYWlsdG86dmVtdW5kQHZlbXVuDQogZC5kZXYNCkFUVEVOREVFO1JPTEU9UkVRLVBB
UlRJQ0lQQU5UO0NVVFlQRT1JTkRJVklEVUFMO1BBUlRTVEFUPU5FRURTLUFDVElPTjtSU1ZQ
DQogPVRSVUU7Q049IlZlbXVuZCBFbGRlZ2FyZCI7RU1BSUw9dmVtdW5kZWxkZWdhcmRAZ21h
aWwuY29tOk1BSUxUTzp2ZW11bmRlbGQNCiBlZ2FyZEBnbWFpbC5jb20NClVSTDtWQUxVRT1V
Ukk6d2hlcmVieS5jb20vdmVtdW5kDQpTVEFUVVM6Q09ORklSTUVEDQpFTkQ6VkVWRU5UDQpF
TkQ6VkNBTEVOREFS
--B_3656959371_1438576101--
The contents of the .ical:
BEGIN:VCALENDAR
VERSION:2.0
PRODID:-//salire.no//salire//EN
METHOD:REQUEST
NAME:My Testfeed
X-WR-CALNAME:My Testfeed
BEGIN:VEVENT
UID:foo123#salire.herokuapp.com
SEQUENCE:0
DTSTAMP:20191118T205906Z
DTSTART:20191118T205906Z
DTEND:20191118T215906Z
SUMMARY:My Event
X-ALT-DESC;FMTTYPE=text/html:<b>mark</b> up! hahah
ORGANIZER;CN="Vemund Eldegard";EMAIL=vemund#vemund.dev:mailto:vemund#vemun
d.dev
ATTENDEE;ROLE=REQ-PARTICIPANT;CUTYPE=INDIVIDUAL;PARTSTAT=NEEDS-ACTION;RSVP
=TRUE;CN="Vemund Eldegard";EMAIL=vemundeldegard#gmail.com:MAILTO:vemundeld
egard#gmail.com
URL;VALUE=URI:whereby.com/vemund
STATUS:CONFIRMED
END:VEVENT
END:VCALENDAR
What can be wrong? I have tried everything, and read every article on the internet trying to figure this out.
The outer message content type is multipart/mixed. Outlook expects a single MIME text/calendar part that contains the calendar data.
I've faced a similar problem and solve it by rewriting a Content-Type header from
text/calendar; charset="utf-8";
to
text/calendar; charset="utf-8"; method=REQUEST
When I've added method=REQUEST to header, outlook started recognise my ics file as an event.
I am using java code to compose and send e-mail messages to MS Outlook 365 accounts.
The message is composed as following:
plain text part;
html part containing only table;
plain text part;
File attachment.
I expect that outlook displays part 1-3 as message body and the last part as attachment. Instead it displays only first part as message itself and puts the rest parts as separate attachments.
I have played with different headers, but result is the same. Is it some feature of MS stack (exchange, outlook, etc.) or I did something wrong?
The raw message is here
Date: Mon, 5 Jun 2017 12:01:47 -0700 (PDT)
From: no-reply#example.com
To: consumer#example.com
Message-ID: <some id>
Subject: Test email
MIME-Version: 1.0
Content-Type: multipart/mixed; boundary="----=_Part_0_2350964.1496689307498"
------=_Part_0_2350964.1496689307498
Content-Type: text/plain; charset=us-ascii
Content-Transfer-Encoding: 7bit
Content-Disposition: inline
Content before table
------=_Part_0_2350964.1496689307498
Content-Type: text/html; charset=us-ascii
Content-Transfer-Encoding: 7bit
Content-Disposition: inline
<html><body><table><tr><td>First parameter</td><td>value</td></tr><tr><td>Second row</td><td>42</td></tr></table></body></html>
------=_Part_0_2350964.1496689307498
Content-Type: text/plain; charset=us-ascii
Content-Transfer-Encoding: 7bit
Content-Disposition: inline
This content should be placed after table
------=_Part_0_2350964.1496689307498
Content-Type: application/octet-stream;
name="report.xls"
Content-Transfer-Encoding: base64
Content-Disposition: attachment; filename="report.xls"
0M8R4KGxGuEAAAAAAAAAAAAAAAAAAAAAOwADAP7/CQAGAAAAAAAAAAAAAAABAAAAAAAAAAAAAAAA
<skipped>
------=_Part_0_2350964.1496689307498--
As a result I see only "Content before table" line, two attachments like "ATT01.html" and "ATT02.txt" and my original attachment "report.xls".
I have found one related topic at some forum saying that this problem should not appear since Outlook 2010 or so, but I can see it in the latest version both in desktop app and the web application.
The workaround solution to put everything in html part requires more work, because text parts are generated by other components.
You are grouping the parts incorrectly. It must be
1. Outer message, multipart/mixed
2. multipart/related
2.a text/plain
2.b text/html
3. attachment.
I'm trying to build up my own Email sending class and it seems I have a bug with my MIME.
If someone could find the error or tell me about a working MIME Validator I would really appreciate that.
Thanks in advance
JD
To: me#mydomain.com
Subject: Test Alternate
X-PHP-Originating-Script: 1000:SendMail.class.php
MIME-Version: 1.0
From: me#mydomain.com
Content-Type: multipart/mixed;
boundary="MultipartMail53dfa8ade817e"
Message-Id: <20140804153717.EA93E160195#myDevice>
Date: Mon, 4 Aug 2014 17:37:17 +0200 (CEST)
X-RCPT-TO: <me#mydomain.com>
Status:
X-UIDL: 706801872
X-IMail-ThreadID: c9b40003d631c851
--MultipartMail53dfa8ade817e
Content-Type: multipart/alternative;
boundary="Alternative53dfa8ade8378"
--Alternative53dfa8ade8378
Content-Type: text/html; charset=ISO-8859-1
Content-Transfer-Encoding: 7bit
Some Text content
--Alternative53dfa8ade8378
Content-Type: text/plain; charset=ISO-8859-1
Content-Transfer-Encoding: 8bit
Das ist Text
--
Text
*Some more Text*
Text
--Alternative53dfa8ade8378--
--MultipartMail53dfa8ade817e--
There's a few things "wrong" with your email:
Firstly, you have a non-header in your header:
To: me#mydomain.com
*Test Alternate*
X-PHP-Originating-Script: 1000:SendMail.class.php
(*'s around the broken bit)
Secondly, (and probably your main issue with Thunderbird) is that your multipart/alternative has the child parts in the wrong order. The way that multipart/alternative is supposed to work is that the last part is supposed to be the form that is closest to what the original author of the message intended for you to see (IOW what he/she saw in their WYSIWYG editor).
TL;DR
Put the text/html part last and the text/plain part first within the multipart/alternative.