adding an image to an email

Giganews Newsgroups
Subject: adding an image to an email
Posted by:  John Evans (johneva…@clear-Advantage.co.uk)
Date: Thu, 14 Apr 2005

Dear all,
            I am building an html document. that includes an image. I want
to send the whole as an email.

When I add the image to the document, I am also adding the following code:
        with TIdAttachment.Create(email.MessageParts, PictureFilename  ) do
        begin
          email.ContentType:='image/jpeg';
        end;
My understanding from the help file is that I have to use TidAttachment for
images.

What I get from the resulting email, is an image placeholder as I designed
it, but no image showing. The image is just an attachment.
I have created the same thing using an email client to see what the email
source should look like.
With the email client I get the following in the source:

------=_NextPart_000_02F8_01C54110.07D021D0
Content-Type: image/jpeg;
name="2.jpg"
Content-Transfer-Encoding: base64
Content-ID: <02f701c54107$a60bb9d0$7c01a8c0@CLEARSERVER>  //this id appears
in the text/html part

With my code the equivalent email source is:

--=_NextPart_2altrfkindysadvnqw3nerasdf--

--=_NextPart_2rfkindysadvnqw3nerasdf
Content-Type: application/octet-stream;
        name="2.jpg"
Content-Transfer-Encoding: base64
Content-Disposition: attachment;
        filename="2.jpg" // this appears in the text/html part

Can anyone advise how to create the image/jpeg part correctly.

many thanks

--
John Evans
Managing Director
Clear Advantage Ltd

www.Clear-Advantage.co.uk

Replies