inline graphics in html email

Giganews Newsgroups
Subject: inline graphics in html email
Posted by:  Malcolm Smith (mjfreelanci…
Date: Mon, 28 Jun 2004


I've managed to work out how to embed images in html emails using the
following (only relevant code shown):

TIdAttachment *Attach = new TIdAttachment(FIdMessage->MessageParts,
Attach->ExtraHeaders->Values["Content-ID"] = "<malcolm1.jpg>";

std::auto_ptr<TStringList> HTMLBody(new TStringList);
HTMLBody->Add("<p><img border=\"0\" src=\"cid:malcolm1.jpg\" width=\"600\"

TIdText *IdText = new TIdText(FIdMessage->MessageParts, FHTMLBody.get());
IdText->ContentType = "text/html";      // see Q2 below
IdText->ContentTransfer = "7bit";

1. This works using:  src=\"cid:malcolm1.jpg\"

    but was an absolute guess.  Is this correct (valid for the protocol) ?

2. I thought I had to use

      IdText->ContentType = "multipart/related";

  but it did not work.  When do you use "multipart/related" ?

Malcolm Smith
MJ Freelancing
Borland Technology Partner