Sunday, April 17, 2011

Images aren't being displayed as embedded in email sent by my application

I'm trying to send an email with embedded images through a delphi application using Indy, but somehow it isn't working.

I compared the contents of the email I sent with one sent from gmail, and everything seens fine, but I might be missing some little detail.

Gmail shows the attached image of my email as a normal attachment, but it is set correctly as inline.

EDIT

Solved using the TIdMessageBuilderHtml it worked perfectly on the first try.

From stackoverflow
  • Solved using the TIdMessageBuilderHtml it worked perfectly on the first try.

    Just a few lines of code:

      with TIdMessageBuilderHtml.Create do
        try
          Subject := 'example';
          Html.Text := 'HTML goes here';
          HtmlFiles.Add('c:\folder\image1.jpg');
          HtmlFiles.Add('c:\folder\image2.jpg');
          FillMessage(IdMessage1);
        finally
          Free;
        end;
    

0 comments:

Post a Comment