The task I'm trying to accomplish is to receive an email, prepend with some content, then forward it to the appropriate person.
My understanding is parts can be nested ("Parts within Parts" section http://rand-mh.sourceforge.net/book/overall/mulmes.html) so this is a summary of my work in progress example:
Content-Type: multipart/mixed;
Content-Type: multipart/alternative;
Content-Type: text/plain;
Content-Type: text/html;
Content-Type: multipart/mixed;
Content-Type: multipart/alternative;
Content-Type: text/plain;
Content-Type: text/html;
The first multipart/alternative is where the prepended content resides. The original email is in the second multipart/alternative.
When I check the email in mail.app, I only see the original email's HTML. I can see the prepended content if I choose to view 'Plain Text Alternative' but the original email content is missing there.
Does anybody see the problem or can suggest a different solution?
Note: the second multipart/mixed is there because I found adjacent multipart/alternative parts merge into one after sending the email. Haven't found out why yet.
Example Email:
Return-Path: <info@example.com>
X-Original-To: v@example.com
Delivered-To: v@example.com
Date: Wed, 25 Jan 2012 04:52:40 -0800
From: <info@example.com>
Reply-To: v@example.com
To: v@example.com
Message-ID: <4f1ffb189742b_aa4857748ec597c0@oblivion.mail>
Subject: Hello World
Mime-Version: 1.0
Content-Type: multipart/mixed;
boundary="--==_mimepart_4f1ffb1029e_aa4857748ec5898b";
charset=UTF-8
Content-Transfer-Encoding: 7bit
----==_mimepart_4f1ffb1029e_aa4857748ec5898b
Date: Wed, 25 Jan 2012 04:52:40 -0800
Mime-Version: 1.0
Content-Type: multipart/alternative;
boundary="--==_mimepart_4f1ffb0ff3742_aa4857748ec588ed";
charset=UTF-8
Content-Transfer-Encoding: 7bit
Content-Disposition: inline
Content-ID: <4f1ffb1895280_aa4857748ec594ad@oblivion.mail>
----==_mimepart_4f1ffb0ff3742_aa4857748ec588ed
Date: Wed, 25 Jan 2012 04:52:40 -0800
Mime-Version: 1.0
Content-Type: text/plain;
charset=UTF-8
Content-Transfer-Encoding: 7bit
Content-ID: <4f1ffb1893e8a_aa4857748ec5929b@oblivion.mail>
Prepended Content Here
---
----==_mimepart_4f1ffb0ff3742_aa4857748ec588ed
Date: Wed, 25 Jan 2012 04:52:40 -0800
Mime-Version: 1.0
Content-Type: text/html;
charset=UTF-8
Content-Transfer-Encoding: 7bit
Content-ID: <4f1ffb1894a70_aa4857748ec59354@oblivion.mail>
<p><i>Prepended Content Here</i><br/>---</p><br/><br/>
----==_mimepart_4f1ffb0ff3742_aa4857748ec588ed--
----==_mimepart_4f1ffb1029e_aa4857748ec5898b
Date: Wed, 25 Jan 2012 04:52:40 -0800
Mime-Version: 1.0
Content-Type: multipart/mixed;
boundary="--==_mimepart_4f1ffb101b14_aa4857748ec591b3";
charset=UTF-8
Content-Transfer-Encoding: 7bit
Content-Disposition: inline
Content-ID: <4f1ffb1896b21_aa4857748ec5965a@oblivion.mail>
----==_mimepart_4f1ffb101b14_aa4857748ec591b3
Date: Wed, 25 Jan 2012 04:52:40 -0800
Mime-Version: 1.0
Content-Type: multipart/alternative;
boundary="--==_mimepart_4f1ffb101a35_aa4857748ec590c1";
charset=UTF-8
Content-Transfer-Encoding: 7bit
Content-Disposition: inline
Content-ID: <4f1ffb189627d_aa4857748ec595b5@oblivion.mail>
----==_mimepart_4f1ffb101a35_aa4857748ec590c1
Date: Wed, 25 Jan 2012 04:52:31 -0800
Mime-Version: 1.0
Content-Type: text/plain;
charset=windows-1252
Content-Transfer-Encoding: quoted-printable
Content-ID: <4f1ffb0fc89c6_aa4857748ec585c@oblivion.mail>
Original Email Content Here
----==_mimepart_4f1ffb101a35_aa4857748ec590c1
Date: Wed, 25 Jan 2012 04:52:31 -0800
Mime-Version: 1.0
Content-Type: text/html;
charset=windows-1252
Content-Transfer-Encoding: quoted-printable
Content-ID: <4f1ffb0fd1ff9_aa4857748ec58622@oblivion.mail>
<html> Long HTML Content Removed </html>=
----==_mimepart_4f1ffb101a35_aa4857748ec590c1--
----==_mimepart_4f1ffb101b14_aa4857748ec591b3--
----==_mimepart_4f1ffb1029e_aa4857748ec5898b--