2

I am working on a mass mailing of a HTML newsletter with a PDF file attached, and I'm having a really strange problem: the PDF attachment can be seen in all the email clients that I've tried... except iOS 8.4.1. Here are the circumstances:

  • The HTML newsletter is built with a Perl script that reads the HTML file, a header image and the PDF file and then constructs the email, using Mail::Sender. It attaches the HTML using multipart/related and then attaches the header image as BASE64 and the PDF as quoted-printable.
  • The PDF attachment can be seen in Yahoo, Gmail, Outlook and Apple Mail.
  • In iOS, the mail appears in the message list with the little paperclip icon that shows that there's an attachment... but when you open the email, the PDF icon doesn't appear anywhere.
  • If I try to create an HTML email in Outlook and attach a PDF file by hand, iOS can see the attachment: it shows up at the bottom of the message, as it should.

Reading the source code of both emails (the one created by Outlook and the one created by my Perl script), I can't see any differences. The Outlook message is as follows:

This is a multipart message in MIME format.

------=_NextPart_000_0022_01D13B86.157B65C0
Content-Type: multipart/alternative;
    boundary="----=_NextPart_001_0023_01D13B86.157B65C0"


------=_NextPart_001_0023_01D13B86.157B65C0
Content-Type: text/plain;
    charset="us-ascii"
Content-Transfer-Encoding: 7bit

(text skipped)

------=_NextPart_001_0023_01D13B86.157B65C0
Content-Type: text/html;
    charset="us-ascii"
Content-Transfer-Encoding: quoted-printable

(text skipped)

------=_NextPart_001_0023_01D13B86.157B65C0--

------=_NextPart_000_0022_01D13B86.157B65C0
Content-Type: application/pdf;
    name="About SVG Viewer.pdf"
Content-Transfer-Encoding: quoted-printable
Content-Disposition: attachment;
    filename="About SVG Viewer.pdf"

And the other one, the one that's giving me trouble, is:

--xysdmkgfekj_eot34dfgvjdf8u4fmfjkdjke29501
Content-Type: multipart/alternative; boundary="Part-xysdmkgfekj_eot34dfgvjdf8u4fmfjkdjke29501_2"

--Part-xysdmkgfekj_eot34dfgvjdf8u4fmfjkdjke29501_2
Content-type: text/plain
Content-transfer-encoding: 7BIT

(text skipped)

--Part-xysdmkgfekj_eot34dfgvjdf8u4fmfjkdjke29501_2
Content-type: text/html
Content-transfer-encoding: 7BIT

(text skipped)

--Part-xysdmkgfekj_eot34dfgvjdf8u4fmfjkdjke29501_2--
--xysdmkgfekj_eot34dfgvjdf8u4fmfjkdjke29501
Content-type: application/pdf; name="About SVG Viewer.pdf"
Content-transfer-encoding: quoted-printable
Content-disposition: attachment; filename="About SVG Viewer.pdf"

(PDF skipped)

--xysdmkgfekj_eot34dfgvjdf8u4fmfjkdjke29501
Content-type: image/jpeg; name="cabecera.jpg"
Content-description: cabecera
Content-transfer-encoding: base64
Content-disposition: inline; filename="cabecera.jpg";
Content-ID: <cabecera>

What is going on?

Cœur
  • 37,241
  • 25
  • 195
  • 267
PaulJ
  • 1,646
  • 5
  • 33
  • 52
  • 1
    You have omitted the content-type headers of the top-level message; is it the same in both cases? – tripleee Jan 11 '16 at 15:28
  • Mmmm... I hadn't looked into it. The Outlook mail says `Content-Type: multipart/mixed`, while the one created with my script says `multipart/related`, as mentioned above. – PaulJ Jan 14 '16 at 20:46

1 Answers1

0

Apparently this is a known issue with iOS. Here is a solution for this:

Add to your perl script:

Id => "<the_file.pdf>",

and then include it in the HTML:

<embed src="cid:the_file.pdf" type="application/pdf" width="100%" height="100%">
Moses Davidowitz
  • 982
  • 11
  • 28