Re: Lost with HTML mail + pdf attachment

Giganews Newsgroups
Subject: Re: Lost with HTML mail + pdf attachment
Posted by:  Remy Lebeau (TeamB) (no.spam@no.spam.com)
Date: Thu, 5 May 2005

"Gerard Visent" <gera…@zootec.ad> wrote in message
news:6CB6555AA7C9E240gera…@zootec.ad...

> I don't know how to assign the file's attachments ParentPart property
> so they show up correctly in all the mail clients.

You shouldn't be setting the ParentPart for non-related attachments at all.
Leave it set at the default of -1.

> This is my code:

Your code is setting up the message wrong.  You did not set the ParentPart
for the "multipart/related" part at all.  The "multipart/alternative" needs
to be its parent part.  And you are setting the ParentPart for non-related
attachments, when they should be on the top-level (ParentPart = -1) of the
message instead.  As a result, your message is producing the following
incorrect layout:

    TIdMessage (multipart/mixed)
    {
        TIdText (multipart/alternative)
        {
            TIdText (text/plain)
            TIdAttachment (application/pdf)
            TIdAttachment (...)
        }
        TIdText (multipart/related)
        {
            TIdText (text/html)
            TIdAttachment (image/*)
        }
    }

It needs to produce the following layout instead:

    TIdMessage (multipart/mixed)
    {
        TIdText (multipart/alternative)
        {
            TIdText (text/plain)
            TIdText (multipart/related)
            {
                TIdText (text/html)
                TIdAttachment (image/*)
        }
        TIdAttachment (application/pdf)
        TIdAttachment (...)
    }

Gambit

Replies

In response to

Lost with HTML mail + pdf attachment posted by Gerard Visent on Thu, 05 May 2005