<div dir="ltr">actually what it turned out to be was me thinking that Indy was smart enough to know if I am passing images in the &quot;Htmlfiles.add()&quot; the TMessageBuilderHTML that it would have replaced the &quot;src&quot; for the image to src=&quot;cid:x&quot;  (x=image index)   but I had to do it myself!<div>Anyway, it works now.</div><div><br></div><div>Jeremy</div></div><div class="gmail_extra"><br><div class="gmail_quote">On Fri, Oct 24, 2014 at 11:44 AM, Robert Martin <span dir="ltr">&lt;<a href="mailto:rob@chreos.co.nz" target="_blank">rob@chreos.co.nz</a>&gt;</span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
  
    
  
  <div text="#000000" bgcolor="#FFFFFF">
    <div>Hi Jeremy <br>
      <br>
      You are right to use TIdMessageBuilderHTML, it is almost
      impossible to get it working correctly otherwise!  I do have it
      working fine.  Below is a snippet from my send class....<br>
      <br>
      <br>
                          //RM 2012/12/06 Use TIdMessageBuilderHtml to
      build email, too hard to do it manually, didn&#39;t 100% work<br>
                          IdMessageBuilderHtml :=
      TIdMessageBuilderHtml.Create;<br>
                          try<br>
                              IdMessageBuilderHtml.HtmlCharSet    :=
      &#39;UTF-8&#39;;                 //RM 2013/11/04 added to deal with UTF8
      text<br>
                              IdMessageBuilderHtml.Html.Text      :=
      fBodyText;<br>
      <br>
                              //Add inline attachments<br>
                              if (fInlineAttachments.Count &gt; 0) then
      begin<br>
                                  for Counter := 0 to
      fInlineAttachments.Count - 1 do begin<br>
                                      InlineAttachment :=
      TInlineAttachment(fInlineAttachments[Counter]);<br>
      <br>
                                     
      IdMessageBuilderHtml.HtmlFiles.Add(InlineAttachment.FileName);<br>
                                     
      IdMessageBuilderHtml.HtmlFiles[Counter].ContentType  :=
      &#39;image/jpg&#39;;<br>
                                     
      IdMessageBuilderHtml.HtmlFiles[Counter].ContentID    := &#39;&lt;&#39; +
      InlineAttachment.ContentID + &#39;&gt;&#39;;<br>
                                  end;<br>
                              end;<br>
      <br>
      <br>
                              //Add email attachments<br>
                              WorkList := TStringList.Create;<br>
                              try<br>
                                  //build list of files<br>
                                  LoadFileList(WorkList, fFileNames);<br>
      <br>
                                  while (WorkList.Count &gt; 0) do begin<br>
                                     
      IdMessageBuilderHtml.Attachments.Add(WorkList[0]);<br>
      <br>
                                      WorkList.Delete(0);<br>
                                  end;<br>
      <br>
                              finally<br>
                                  WorkList.Free;<br>
                              end;<br>
      <br>
                              IdMessageBuilderHtml.PlainText.Text := &#39;
      &#39;;<br>
                             
      IdMessageBuilderHtml.FillMessage(EmailMessage);<br>
                          finally<br>
                              IdMessageBuilderHtml.Free;<br>
                          end;<br>
      <br>
      <br>
      <br>
      <br>
      TInlineAttachment is a class I have, the definition is below...<br>
      <br>
        //Rm 2012/11/02 class added to detail each inline image<br>
        TInlineAttachment = class<br>
        private<br>
          fContentID      : String;           //Link to tag in HTML body
      (i.e. html might be &#39;&lt;img src=<a>&quot;cid:us.jpg&quot;</a> /&gt;&#39; so fContentID
      is &#39;us.jpg&#39;  <br>
          fContentType    : String;           //What type of content
      i.e. &#39;image/jpeg&#39; for a jpg image<br>
          fFileName       : String;           //Qualified link to image
      file<br>
        public<br>
          property ContentID : String read fContentID write fContentID;<br>
          property FileName : String read fFileName write fFileName;<br>
          property ContentType : String read fContentType write
      fContentType;<br>
      <br>
          Constructor Create(aContentID, aFileName, aContentType :
      String);<br>
        end;<br>
      <br>
      <br>
      <br>
      Content ID is just a unique name.  In the code this is from they
      are things like &#39;header.jpg&#39;.<br>
      <br>
      Hope that gets you going.  I can show you more code if you
      need.  <br>
      <br>
      Cheers<br>
      Rob<div><div class="h5"><br>
      <br>
      <br>
      <br>
      <br>
       On 23/10/2014 6:51 p.m., Jeremy Coulter wrote:<br>
    </div></div></div>
    <blockquote type="cite"><div><div class="h5">
      <div dir="ltr">Hi All.
        <div>I am using Indy to send emails. I have swapped from another
          control to Indy.</div>
        <div>The emails are HTML email, HOWEVER.....when I am sending
          emails with embedded images, but they are not displaying in
          the actual email, with the location where the image should
          appear displaying the red &quot;x&quot; in a box. The image IS in the
          email and it appears as an attachment when I open the email.</div>
        <div><br>
        </div>
        <div>I did a bit of a search around and found that there is now
          a new class called TIdMessageBuilderHTML. I have copy and
          pasted the example from the INDY website, and it made no
          difference. It LOOKED promising :-( </div>
        <div><br>
        </div>
        <div>I have tried creating the email using the correct context
          type and using the messagepart property setting the
          contentdisposition to inline etc, but I get the same result!</div>
        <div><br>
        </div>
        <div>Has anyone ever got this too work as it should?</div>
        <div><br>
        </div>
        <div>Thanks, Jeremy</div>
      </div>
      <br>
      <fieldset></fieldset>
      <br>
      </div></div><pre>_______________________________________________
NZ Borland Developers Group - Delphi mailing list
Post: <a href="mailto:delphi@listserver.123.net.nz" target="_blank">delphi@listserver.123.net.nz</a>
Admin: <a href="http://delphi.org.nz/mailman/listinfo/delphi" target="_blank">http://delphi.org.nz/mailman/listinfo/delphi</a>
Unsubscribe: send an email to <a href="mailto:delphi-request@listserver.123.net.nz" target="_blank">delphi-request@listserver.123.net.nz</a> with Subject: unsubscribe</pre>
      <br>
      <fieldset></fieldset>
      <br>
      <p color="#000000" align="left">No virus
        found in this message.<br>
        Checked by AVG - <a href="http://www.avg.com" target="_blank">www.avg.com</a><br>
        Version: 2015.0.5315 / Virus Database: 4181/8435 - Release Date:
        10/22/14</p>
    </blockquote>
    <br>
  </div>

<br>_______________________________________________<br>
NZ Borland Developers Group - Delphi mailing list<br>
Post: <a href="mailto:delphi@listserver.123.net.nz">delphi@listserver.123.net.nz</a><br>
Admin: <a href="http://delphi.org.nz/mailman/listinfo/delphi" target="_blank">http://delphi.org.nz/mailman/listinfo/delphi</a><br>
Unsubscribe: send an email to <a href="mailto:delphi-request@listserver.123.net.nz">delphi-request@listserver.123.net.nz</a> with Subject: unsubscribe<br></blockquote></div><br></div>