Hi,
I'd like to know how to build an SMTP multipart message in the correct order so that it will render correctly on the iPhone mail client (rendering correctly in GMail).
I'm using Javamail to build up an email containing the following parts:
A body part with
content type "text/html; UTF-8"
An embedded image attachment.
A file attachment
I am sending the mail via GMail SMTP (via SSL) and the mail is sent and rendered correctly using a GMail account, however, the mail does not render correctly on the iPhone mail client. On the iPhone mail client, the image is rendered before the "Before Image" text when it should be rendered afterwards. After the "Before Image" text there is an icon with a question mark (I assume it means it couldn't find the referenced CID). I'm not sure if this is a limitation of the iPhone mail client or a bug in my mail sending code (I strongly assume the latter).
I think that perhaps the headers on my parts might by incorrect or perhaps I am providing the multiparts in the wrong order. I include the text of the received mail as output by gmail (which renders the file correc
Message-ID: <
[email protected]>
Subject: =?UTF-8?Q?Test_from_=E3=82=AF=E3=83=AA=E3=82=B9?=
MIME-Version: 1.0
Content-Type: multipart/mixed;
boundary="----=_Part_0_20870565.1274154021755"
------=_Part_0_20870565.1274154021755
Content-Type: application/octet-stream
Content-Transfer-Encoding: base64
Content-ID: <20100518124021763_368238_0>
iVBORw0K ----- TRIMMED FOR CONCISENESS
6p1VVy4alAAAAABJRU5ErkJggg==
------=_Part_0_20870565.1274154021755
Content-Type: text/html; charset=UTF-8
Content-Transfer-Encoding: 7bit
<html><head><title>Employees Favourite Foods</title>
<style>
body { font: normal 8pt arial; }
th { font: bold 8pt arial; white-space: nowrap; }
td { font: normal 8pt arial; white-space: nowrap; }
</style></head><body>
Before Image<br><img src="cid:20100518124021763_368238_0">
After Image<br><table border="0">
<tr>
<th colspan="4">Employees Favourite Foods</th>
</tr>
<tr>
<th align="left">Name</th><th align="left">Age</th><th align="left">Tel.No</th><th align="left">Fav.Food</th>
</tr>
<tr style="background-color:#e0e0e0">
<td>Chris</td><td>34</td><td>555-123-4567</td><td>Pancakes</td>
</tr>
</table></body></html>
------=_Part_0_20870565.1274154021755
Content-Type: text/plain; charset=us-ascii; name=textfile.txt
Content-Transfer-Encoding: 7bit
Content-Disposition: attachment; filename=textfile.txt
This is a textfile with numbers counting from one to ten beneath this line:
one
two
three
four
five
six
seven
eight
nine
ten(no trailing carriage return)
------=_Part_0_20870565.1274154021755--
Even if you can't assist me with this, I would appreciate it if any members of the forum could forward me a (non-personal) mail that includes inline images (not external hyperlinked images though). I just need to find a working sample then I can move past this.
Thanks,
Chris.