Hi,
I’ve built a system for sending out HTML emails via PHP with a plain text alternative. It works fine on all the systems I’ve tested it on (Mac/PC, Outlook, Apple Mail, Thunderbird, Hotmail, Yahoo, GMail, Android) but not on the client’s PC (software unknown) and iPhone. What he gets is the raw source of the message, starting from just before the end of the headers.
In trying to work out why it wasn’t working I looked at some big-name HTML emails that I’d received. One of the main differences was that I was using this:
Content-Type: text/plain; charset="iso-8859-1"
Content-Transfer-Encoding: 7bit
whereas others were using:
Content-type: text/plain; charset=utf-8
Content-Transfer-Encoding: quoted-printable
After much messing around I switched over to using quoted-printable (with short lines and encoded characters) and eventually got it working properly in all systems but still no iPhone.
Then I noticed that everyone else split the Content-type header onto two lines like this:
Content-Type: multipart/alternative;
boundary="_=aspNetEmail=_13b32563657941d184950670b21757ab"
I tried that and also tried a much shorter boundary string and that also made no difference.
I’ve spent most of the day on this and it’s starting to drive me mad so I hope someone can help. Here’s the source from a typical email (with a couple of bits omitted):
Delivered-To: xxx@googlemail.com
Received: by xx.xx.xx.xx with SMTP id da6cs21405vcb;
Fri, 25 Mar 2011 08:56:16 -0700 (PDT)
Return-Path: <anonymous@xxxxxx.co.uk>
Received: from xxxxxxxx.co.uk (xxxxx.co.uk [xxx.xxx.xxx.xxx])
by mx.google.com with ESMTPS id o11si1892331wer.9.2011.03.25.08.56.14
(version=TLSv1/SSLv3 cipher=OTHER);
Fri, 25 Mar 2011 08:56:14 -0700 (PDT)
Received-SPF: pass (google.com: best guess record for ......
Received: (qmail 22592 invoked by uid 10006); 25 Mar 2011 15:56:14 +0000
Date: 25 Mar 2011 15:56:14 +0000
Message-ID: <20110325155614.22590.qmail@xxxxxxx.co.uk>
To: xxx@googlemail.com
Subject: ...
From: Sender <web@xxxxxxx.co.uk>
Reply-To: web@xxxxxxx.co.uk
X-Mailer: PHP
MIME-Version: 1.0
Content-Type: multipart/alternative; boundary="PHP-alt-46832"
Content-Transfer-Encoding: quoted-printable
--PHP-alt-46832
Content-type: text/plain; charset=utf-8
Content-Transfer-Encoding: quoted-printable
[plain text content]
--PHP-alt-46832
Content-type: text/html; charset=utf-8
Content-Transfer-Encoding: quoted-printable
[html content]
--PHP-alt-46832--
Anyone have any ideas? The problem systems start showing the raw source from the ‘MIME-Version’ line, though I’ve tried removing that line and the one before it but neither makes a difference.
Thanks,