In my Go application, I'm building and sending multi-part emails with HTML body and PDF attachments. Gmail displays my emails correctly, however the Apple iOS email app doesn't. It only shows the attachment and no text (html) at all.
My emails look like this (I've removed the content for the example):
MIME-Version: 1.0
From: Example <info#example.com>
To: example#gmail.com
Reply-to: info#example.com
Subject: Bla-bla
Content-Type: multipart/alternative;
boundary="3fca6de57f7044cd34adb5454428fd5e5d56e939f26028c745d7b130ca4fa343"
Message-ID: <010201713b392a40-fbba1c61-23e5-44f5-a26a-f83a1598c885-000000#eu-west-1.amazonses.com>
Date: Thu, 2 Apr 2020 14:08:54 +0000
X-SES-Outgoing: 2020.04.02-54.240.7.18
Feedback-ID: 1.eu-west-1.Kpg92BT/SvZS11gkp8+PRgxZ4fKdPt7sUnI7TvXld8g=:AmazonSES
--3fca6de57f7044cd34adb5454428fd5e5d56e939f26028c745d7b130ca4fa343
Content-Type: text/html; charset="UTF-8"
<!DOCTYPE html>
<html lang="en">
<head>
...
</head>
<body>
...
</body>
</html>
--3fca6de57f7044cd34adb5454428fd5e5d56e939f26028c745d7b130ca4fa343
Content-Type: application/pdf; charset="UTF-8"
Content-Transfer-Encoding: base64
Content-Disposition: attachment;filename="afile.pdf"
--3fca6de57f7044cd34adb5454428fd5e5d56e939f26028c745d7b130ca4fa343--
So, I get the email, it has the attachment, but not the text. This only occurs with iOS mail app. By the way, I've googled this issue and found a few topics where iPhone users complained about the same problem with their built-in mail...
Changing the content type of the email itself from multipart/alternative to multipart/mixed helped. Now my emails are displayed correctly both in Gmail and iOS Apple mail.
I've also tried to switch between plain/base64 HTML and inline/no content disposition for HTML part, but that had no effect.
Hope this helps somebody.
Related
I have a multipart/alternative email that works perfectly on Gmail, Yahoo, and any others I've tried... besides Hotmail (and anything Microsoft I presume.)
The email just appears as raw text on Hotmail.
No matter the amount of times I slam my head against the wall and shout swearwords towards Microsoft which has become a daily activity, I cannot figure out why it doesn't work. Can you?
Here is the email if you want to try it yourself:
Headers:
MIME-Version: 1.0
Content-Type: multipart/alternative;
boundary="----=_Part_18243133_1346573420.1408991447668"
Body:
------=_Part_18243133_1346573420.1408991447668
Content-Type: text/plain; charset=UTF-8
Hello world.
------=_Part_18243133_1346573420.1408991447668
Content-Type: text/html; charset=UTF-8
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
</head>
<body>
<p style="margin-top:50px;font-size:9px;">Hello world</p>
</body></html>
------=_Part_18243133_1346573420.1408991447668--
Here is the full code if you want to test it on your server, either use phpmail or wp_mail() that I'm using.
Update: Here is a source of received message to hotmail.
Probably it is copy-paste to pastbin bug, but your eml contains a space in delimiter line. See here:
--====f230673f9d7c359a81ffebccb88e5d61==
Content-Type: multipart=...<CR><LN>
<SPACE><CR><LN>
^^^^^^^
--====1fdbf23c3658d752511a8dbe74788e30==
If it is not a copy-paste bug than hotmail just can not recognize end of mime entity header.
What you have looks look to be compliant with RFC2046, so it should work with all MUA's (including Hotmail). But having said that, the way this message is structured is somewhat unusual, and it could be that Hotmail just isn't capable of handing such a message properly, even though it is within spec as far as RFC is concerned.
The more common way of structuring a message containing both a plain text body and an HTML body is to specify multipart/mixed in the headers, then create a multipart/alternative section which encompasses both the plain text body part and the HTML body part, using 'subboundaries' (for lack of a better term) to separate the two body parts. See below:
Message Headers
MIME-Version: 1.0
Content-Type: multipart/mixed;
boundary="====f230673f9d7c359a81ffebccb88e5d61=="
Message Body
--====f230673f9d7c359a81ffebccb88e5d61==
Content-Type: multipart/alternative;
boundary="====1fdbf23c3658d752511a8dbe74788e30=="
--====1fdbf23c3658d752511a8dbe74788e30==
Content-Type: text/plain; charset="us-ascii"
Content-Transfer-Encoding: 7bit
Hello world.
--====1fdbf23c3658d752511a8dbe74788e30==
Content-Type: text/html; charset="us-ascii"
Content-Transfer-Encoding: 7bit
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
</head>
<body>
<p style="margin-top:50px;font-size:9px;">Hello world</p>
</body></html>
--====1fdbf23c3658d752511a8dbe74788e30==--
--====f230673f9d7c359a81ffebccb88e5d61==--
I have a problem with special characters in the preheader in iPhone 5. When I send the email shown below (code and headers taken from the hotmail webclient) it shows the special characters (æøå) correct in both subject and the body itself, however, when it's displayed in the preheader it shows ? so some sort of incorrect interpretation of the encoding.
The problem only occurs when opening the email in iPhone (tested with iphone 5) using the native mail client and only when it's linked to a hotmail account. If it's sent to any other acount e.g gmail and opened in the same client it's rendered correctly. The problem has been reproduced on three different iPhones (two of which are running 7.1.2 I do not know what the last one is running).
In the example shown here the characters are html entities, in other tests I've tried with the actual characters with the same result. I've also tried without the meta headers, still same result.
The example is as basic as I can make it, I've tested with more realistic emails and have exactly the same issue.
Has anyone else seen a similar issue, or does anyone know what could cause this problem ?
Subject: =?utf-8?B?w6bDuMOl?=
Content-Type: multipart/mixed;
boundary="----=_Part_434_1665025495.1410355480247"
------=_Part_434_1665025495.1410355480247
Content-Type: multipart/alternative;
boundary="----=_Part_435_224090408.1410355480247"
------=_Part_435_224090408.1410355480247
Content-Type: text/plain; charset="utf-8"
Content-Transfer-Encoding: quoted-printable
=E6=F8=E5 ABC Webcopy text =09
[image]
Header =09
text =09
[image]
Header =09
text =09
[image]
Text =09
Unsubscribe text =09
------=_Part_435_224090408.1410355480247
Content-Type: text/html; charset="utf-8"
Content-Transfer-Encoding: 7bit
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN""http://www.w3.org/TR/html4/loose.dtd" encoding="UTF-8">
<html encoding="UTF-8">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<meta name="viewport" content="width=device-width">
<meta name="format-detection" content="telephone=no">
<meta http-equiv="X-UA-Compatible" content="IE=edge" />
<body>
<div>
æøå ABC Webcopy text
</div>
</html>
------=_Part_435_224090408.1410355480247--
------=_Part_434_1665025495.1410355480247--
Finally figured it out.
The preheader is taken from the text/plain version and not the html version, and the text/plain version was encoded as iso-8859-1 and not as the encoding header stated utf-8. After changing the content-encoding header everything worked perfectly.
I am working on an integration with OneNote using the REST API.
I'm trying to create a note but I'm always receiving 400 response code, with the following message: "The multi-part payload was malformed."
URL:
https://www.onenote.com/api/v1.0/pages
Headers:
Content-Type: multipart/form-data; boundary=NewPart
Authorization: Bearer myToken
--NewPart
Content-Type: text/html
Content-Disposition: form-data; name="Presentation"
<!DOCTYPE html>
<html>
<head>
<title>One Note test</title>
<meta name="created" content="2014-04-13T10:36:28+01:00"/>
</head>
<body>
<p>Hello OneNote World</p>
</body>
</html>
--NewPart--
If I try the same request in the apigee tool (https://apigee.com/onenote/embed/console/onenote), it's working perfectly.
I have initially tried to not use multi-part, but all the notes sent without multi-part were missing the note body on the OneNote site. Here is my post on this other issue:
OneNote body is not sent when using non-multipart REST
Make sure the presentation part lines end in CRLF. We've noticed that when using some tools like Fiddler, when you try to reissue and edit a previous request, it removes the CRLF endings from the lines.
I have a problem with the mimemail module on drupal 6.
I'm developing a site on a virtual Unix server and the SMTP server is Micorsoft Exchange (on another server of course) and I'm using mimemail and SMTP modules to send emails.
When I configure the SMTP module by itself, everything is correct and I receive the test message in the correct format.
If I enable mimemail, set the "Use mime mail for all messages" and then I configure the SMTP, the message arrives but it is not correctly encoded.
I hope that someone can give me an help.
I spent a lot of time searching the web for a solution but I was not able to find an answer.
Here is the test message I receive:
This is a multi-part message in MIME format.
--ca2a0ce37a649a90e1efc6d650f2387c
Content-Type: multipart/mixed; boundary="44b02f56426ca5bf19322ab80ca53d99"
Content-Disposition: inline
Content-Transfer-Encoding: 8bit
--44b02f56426ca5bf19322ab80ca53d99
Content-Type: text/plain; charset=utf-8
Content-Disposition: inline
Content-Transfer-Encoding: 8bit
If you receive this message it means your site is capable of sending e-mail.
--44b02f56426ca5bf19322ab80ca53d99
Content-Type: text/html; charset=utf-8
Content-Disposition: inline
Content-Transfer-Encoding: 8bit
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<style type="text/css">
<!--
#charset "UTF-8";
body{background:#FFF;}
*{font-family:Arial,Helvetica,sans-serif;font-size:12px;color:#006;}
-->
</style>
</head>
<body id="mimemail-body" class="mail-smtp-smtp-test">
<div id="center">
<div id="main">
<p>If you receive this message it means your site is capable of sending e-mail.</p>
</div>
</div>
</body>
</html>
--44b02f56426ca5bf19322ab80ca53d99--
--ca2a0ce37a649a90e1efc6d650f2387c--
I'm trying to test Gmail Schemas where the sender and the recipient are the same(mine) account following the Self Testing Notes
You can easily test if your markup is working correctly end-to-end by
sending emails with schemas to your Gmail account. All emails where
the sender and the recipient are the same account ignore the
registration requirements and can be used for self-testing.
but without the expected result, the "Action" button is not displayed.
I have tried using both the JSON-LD and Microdata without results.
Here the "Show original" of the email from my Gmail Account:
Return-Path: <fake-account-email-x#gmail.com>
Received: *****
Message-ID: <fake-email-id#gmail.com>
Date: Tue, 12 Nov 2013 09:41:53 +0100
From: Cristian <fake-account-email-x#gmail.com>
User-Agent: Mozilla/5.0 (X11; Linux i686; rv:17.0) Gecko/20130330 Thunderbird/17.0.5
MIME-Version: 1.0
To: fake-account-email-x#gmail.com
Subject: test
Content-Type: multipart/alternative;
boundary="------------090703050903040805020509"
This is a multi-part message in MIME format.
--------------090703050903040805020509
Content-Type: text/plain; charset=ISO-8859-1; format=flowed
Content-Transfer-Encoding: 7bit
Ciao ${FIRSTNAME}$
* punto 1
* punto 2
* punto 3
--------------090703050903040805020509
Content-Type: text/html; charset=ISO-8859-1
Content-Transfer-Encoding: 7bit
<html>
<head>
<meta http-equiv="content-type" content="text/html; charset=ISO-8859-1">
</head>
<body bgcolor="#FFFFFF" text="#000000">
<div itemscope="" itemtype="http://schema.org/EmailMessage">
<meta itemprop="description" content="Approval request for John's
$10.13 expense for office supplies">
<div itemprop="action" itemscope=""
itemtype="http://schema.org/ConfirmAction">
<meta itemprop="name" content="Approve Registration">
<div itemprop="handler" itemscope=""
itemtype="http://schema.org/HttpActionHandler">
<link itemprop="url" href="http://www.example.com/">
</div>
</div>
</div>
<h1>Ciao ${FIRSTNAME}$</h1>
<ul>
<li>punto 1</li>
<li>punto 2</li>
<li>punto 3</li>
</ul>
</body>
</html>
--------------090703050903040805020509--
And here how it appears from the list:
And inside the message:
I have also validated my code via the Markup Tester
Where is the error in my test? I can't figure out :(
UPDATE 20131113
Sending the email via Test Gmail Schemas, as suggested Devnook, all works fine, but using my Thunderbird client(using my account via SMTP) nope.
Here the source from the test via "Test Gmail Schema"
Delivered-To: fake-account-email-x#gmail.com
Received: by 10.224.58.135 with SMTP id g7csp190326qah;
Tue, 12 Nov 2013 22:48:43 -0800 (PST)
X-Google-DKIM-Signature: *********
X-Original-Authentication-Results: ********
Return-Path: <3yyCDUg0JErIYeSad-SUlagfkYeSad.UgeUjaklaSf.hgjlS.UjpYeSad.Uge#2UIX4H7XYGSZ66WEERLQ.apphosting.bounces.google.com>
Received-SPF: pass ********
Authentication-Results: mr.google.com;
spf=pass ********
X-Received: from mr.google.com ([10.224.24.65])
by 10.224.24.65 with SMTP id u1mr35599473qab.6.1384325323511 (num_hops = 1);
Tue, 12 Nov 2013 22:48:43 -0800 (PST)
MIME-Version: 1.0
X-Received: by 10.224.24.65 with SMTP id u1mr25556165qab.6.1384325323474; Tue,
12 Nov 2013 22:48:43 -0800 (PST)
X-Google-Appengine-App-Id: s~gmail-actions
X-Google-Appengine-App-Id-Alias: gmail-actions
Message-ID: <fake-email-id#google.com>
Date: Wed, 13 Nov 2013 06:48:43 +0000
Subject: Testing Gmail Actions 2013-11-13 06:48
From: fake-account-email-x#gmail.com
To: fake-account-email-x#gmail.com
Content-Type: multipart/alternative; boundary=001a11c2c63a28cf0504eb095b6e
--001a11c2c63a28cf0504eb095b6e
Content-Type: text/plain; charset=ISO-8859-1; format=flowed; delsp=yes
Ciao ${FIRSTNAME}$
punto 1
punto 2
punto 3
--001a11c2c63a28cf0504eb095b6e
Content-Type: text/html; charset=ISO-8859-1
<html>
<head>
<meta http-equiv="content-type" content="text/html; charset=ISO-8859-1">
</head>
<body bgcolor="#FFFFFF" text="#000000">
<div itemscope="" itemtype="http://schema.org/EmailMessage">
<meta itemprop="description" content="Approval request for John's
$10.13 expense for office supplies">
<div itemprop="action" itemscope=""
itemtype="http://schema.org/ConfirmAction">
<meta itemprop="name" content="Approve Registration">
<div itemprop="handler" itemscope=""
itemtype="http://schema.org/HttpActionHandler">
<link itemprop="url" href="http://www.example.com/">
</div>
</div>
</div>
<h1>Ciao ${FIRSTNAME}$</h1>
<ul>
<li>punto 1</li>
<li>punto 2</li>
<li>punto 3</li>
</ul>
</body>
</html>
--001a11c2c63a28cf0504eb095b6e--
The "big" difference are that the headers of this email contains the DKIM-Signature and SPF but in theory emails where the sender and the recipient are the same account ignore the registration requirements
Here how it appear the "correct" email
I tested your email (sent it to myself using http://gmail-actions.appspot.com/) and I got the action appearing in my inbox. So your markup is fine... Are you sure you are not forwarding your email to another account?
Maybe try if other sample emails from gmail-actions.appspot.com work. If not, maybe you have some lab enabled in your inbox or a theme that is blocking the button to appear?
Also, this works only on a desktop afaik.
When I attempt to DKIM sign the message myself, checkmyauth#auth.returnpath.net returns:
WARNING: The From domain 'gmail.com' does NOT match the DKIM domain
and gmail omits the headers (and my email remains unsigned).
Yahoo says DKIM passed by the way.
This sucks, no way to programatically test gmail actions if self signed emails to self are considered spam.
Mirza