Email rendering problem

I have a script that creates and send emails. It can handle plain text and html as well as inline images and attachments but it has a rendering problem when both inline images and attachments are present - at least with Mac Mail. The problem is that the inline images are displayed twice, once in the body of the html and then as attachments.

If there is no attachment (the pdf), just the two inline images, then the email renders properly. Mac Mail still recognized the inline images as attachments but does not render them twice.

I’m not sure if the bug is in my code or in Mac Mail. Here is the email as received by Mac Mail (most of the header is removed).

MIME-Version: 1.0
Content-Type: multipart/mixed;
    boundary="OEM_Scripts_mailer==13680974577==3"


This is a multi-part message in MIME format.

--OEM_Scripts_mailer==13680974577==3
Content-Type: multipart/alternative;
    boundary="OEM_Scripts_mailer==13680974577==2"

--OEM_Scripts_mailer==13680974577==2
Content-Type: text/plain;
    charset="iso-8859-1";
    format=flowed

{{{ text }}}

--OEM_Scripts_mailer==13680974577==2
Content-Type: multipart/related;
    boundary="OEM_Scripts_mailer==13680974577==1"

--OEM_Scripts_mailer==13680974577==1
Content-Type: text/html;
    charset="iso-8859-1"
Content-Transfer-Encoding: quoted-printable

{{{ html }}}

--OEM_Scripts_mailer==13680974577==1
Content-Transfer-Encoding: base64
Content-Id: <iguana-170-13680974577@cardumen.com>
Content-Type: image/jpeg;
	name=iguana-170.jpg
Content-Disposition: inline;
	filename=iguana-170.jpg

{{{ iguana-170.jpg }}}

--OEM_Scripts_mailer==13680974577==1
Content-Transfer-Encoding: base64
Content-Id: <cattleya-13680974577@cardumen.com>
Content-Type: image/jpeg;
	name=cattleya.jpg
Content-Disposition: inline;
	filename=cattleya.jpg

{{{ cattleya.jpg }}}

--OEM_Scripts_mailer==13680974577==1--

--OEM_Scripts_mailer==13680974577==2--

--OEM_Scripts_mailer==13680974577==3
Content-Transfer-Encoding: base64
Content-Type: application/pdf;
    name="test.pdf"
Content-Disposition: attachment;
    filename=test.pdf

{{{ test.pdf }}}

--OEM_Scripts_mailer==13680974577==3--

I’m… fairly certain this is a email-client problem.

Have you tried viewing the email in another client?

The only other client I have is Yahoo mail. It renders the body correctly but it only shows two attachments, the first inline image (it renders both in the html) and the attached pdf.

Are there any volunteers to look at my email in various clients? If so, please send me your email address by PM. Thanks.