<html>
<head>
<meta content="text/html; charset=UTF-8" http-equiv="Content-Type">
</head>
<body text="#000000" bgcolor="#FFFFFF">
<div class="moz-cite-prefix">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't 100% work<br>
IdMessageBuilderHtml :=
TIdMessageBuilderHtml.Create;<br>
try<br>
IdMessageBuilderHtml.HtmlCharSet :=
'UTF-8'; //RM 2013/11/04 added to deal with UTF8
text<br>
IdMessageBuilderHtml.Html.Text :=
fBodyText;<br>
<br>
//Add inline attachments<br>
if (fInlineAttachments.Count > 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 :=
'image/jpg';<br>
IdMessageBuilderHtml.HtmlFiles[Counter].ContentID := '<' +
InlineAttachment.ContentID + '>';<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 > 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 := '
';<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 '<img src=<a class="moz-txt-link-rfc2396E" href="cid:us.jpg">"cid:us.jpg"</a> />' so fContentID
is 'us.jpg' <br>
fContentType : String; //What type of content
i.e. 'image/jpeg' 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 'header.jpg'.<br>
<br>
Hope that gets you going. I can show you more code if you
need. <br>
<br>
Cheers<br>
Rob<br>
<br>
<br>
<br>
<br>
On 23/10/2014 6:51 p.m., Jeremy Coulter wrote:<br>
</div>
<blockquote
cite="mid:CAGYhmGhU9NsOn7qPA86qWzO3jgEaQa9uREeNsB5VfELbmGo8jA@mail.gmail.com"
type="cite">
<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 "x" 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 class="mimeAttachmentHeader"></fieldset>
<br>
<pre wrap="">_______________________________________________
NZ Borland Developers Group - Delphi mailing list
Post: <a class="moz-txt-link-abbreviated" href="mailto:delphi@listserver.123.net.nz">delphi@listserver.123.net.nz</a>
Admin: <a class="moz-txt-link-freetext" href="http://delphi.org.nz/mailman/listinfo/delphi">http://delphi.org.nz/mailman/listinfo/delphi</a>
Unsubscribe: send an email to <a class="moz-txt-link-abbreviated" href="mailto:delphi-request@listserver.123.net.nz">delphi-request@listserver.123.net.nz</a> with Subject: unsubscribe</pre>
<br>
<fieldset class="mimeAttachmentHeader"></fieldset>
<br>
<p class="" avgcert""="" color="#000000" align="left">No virus
found in this message.<br>
Checked by AVG - <a moz-do-not-send="true"
href="http://www.avg.com">www.avg.com</a><br>
Version: 2015.0.5315 / Virus Database: 4181/8435 - Release Date:
10/22/14</p>
</blockquote>
<br>
</body>
</html>