Re: inline graphics in html email

Giganews Newsgroups
Subject: Re: inline graphics in html email
Posted by:  Remy Lebeau (TeamB) (gambit47.no.spam@no.spam.yahoo.com)
Date: Mon, 28 Jun 2004

"Malcolm Smith" <mjfreelanci…@optusnet.com.au> wrote in message
news:15EE9661CAA2E240mjfreelanci…@optusnet.com.au...

> Attach->ExtraHeaders->Values["Content-ID"] = "<malcolm1.jpg>";

Use the ContentID property instead:

    Attach->ContentID = "<malcolm1.jpg>";

> std::auto_ptr<TStringList> HTMLBody(new TStringList);
> HTMLBody->Add("<p><img border=\"0\" src=\"cid:malcolm1.jpg\" width=\"600\"
> height=\"450\"></p>");
>
> TIdText *IdText = new TIdText(FIdMessage->MessageParts, FHTMLBody.get());

You don't need a separate TStringList for that:

    TIdText *IdText = new TIdText(FIdMessage->MessageParts, NULL);
    IdText->Body->Text = "<p><img border=\"0\" src=\"cid:malcolm1.jpg\"
width=\"600\" height=\"450\"></p>";

> 1. This works using:  src=\"cid:malcolm1.jpg\"
>
>    but was an absolute guess.  Is this correct (valid for the protocol) ?

The value of the ContentID is arbitrary.  You can use anything you want,
just as long as the value is unique in the context of the message that is
using it.

> 2. I thought I had to use
>
>      IdText->ContentType = "multipart/related";

Why would you think that?

> When do you use "multipart/related" ?

For Indy 9, you wouldn't.  Multipart/related only works when you have nested
message parts, which Indy 9 does not support.

Gambit

Replies

In response to

inline graphics in html email posted by Malcolm Smith on Mon, 28 Jun 2004