Emails have no html body in Apple iOS mail app

Viewed 860

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...

1 Answers

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