Article

From:
To:
Jonathan Hyams
Subject:
Re: HTML email - views fine in Outlook, wrong in GMail and other webmail viewers
Newsgroup:
atozedsoftware.indy.protocol.smtp

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


"Jonathan Hyams" <✉btopenworld.com> wrote in message
news:✉btopenworld.com...

> Here's my code:

You did not include a "plain/text" part. Some readers require that in order
for HTML to work correctly.  Try this instead:

    var         Folder: String     begin         Folder := ExtractFilePath(Application.ExeName);
        //...
        MyMessage.IsEncoded := True ;         MyMessage.ContentType := 'multipart/alternative';         MyMessage.ClearBody;
        with TIdText.Create(MyMessage.MessageParts, nil) do         begin             Body.Text := 'Your reader does not support HTML';             ContentType := 'text/plain';         end;
        with TIdText.Create(myMessage.MessageParts, nil) do         begin             ContentType := 'multipart/related; type="text/html"';         end;
        with TIdText.Create(myMessage.MessageParts, nil) do         begin             Body.LoadFromFile(Folder + 'htmlmail.htm');             ContentType := 'text/html';             ParentPart := 1;         end;
        with TIdAttachmentFile.Create(myMessage.MessageParts, Folder + 'image001.jpg') do         begin             ContentID := '10001';             ContentType := 'image/jpeg';             ContentDisposition := 'inline';             ParentPart := 1;         end;
        //...     end;

Gambit
FYI: Phrase searches are enclosed in either single or double quotes
 
 
Originally created by
Tamarack Associates
Mon, 13 May 2024 13:31:27 UTC
Copyright © 2009-2024
HREF Tools Corp.