HTML email - views fine in Outlook, wrong in GMail and other webmail viewers

Giganews Newsgroups
Subject: HTML email - views fine in Outlook, wrong in GMail and other webmail viewers
Posted by:  Jonathan Hyams (jhya…@btopenworld.com)
Date: Tue, 9 Oct 2007

Having followed the code examples on the website I have HTML email with
embedded images working fine - as long as they are received in Outlook. In
GoogleMail or in YahooMail the images are unrelated attachments and the mail
shows the standard X symbol for a missing image in the body of the mail.

Here's my code:

      MyMessage.IsEncoded:=True ;
      MyMessage.ContentType:='multipart/related; type="text/html"';
      MyMessage.Body.Clear;
      MyMessage.MessageParts.Clear;
      with TIdText.Create(myMessage.MessageParts, nil) do begin
        Body.LoadFromFile('htmlmail.htm');
        ContentType := 'text/html';
      end;

      with TIdAttachmentFile.Create(myMessage.MessageParts, 'image001.jpg')
do begin
            ContentID := '10001';
            ContentType := 'image/jpeg';
            ContentDisposition := 'inline';
      end;

Replies