How To…Email HTML messages with inline images

Question

“Is it possible to send an email with an HTML body including inline images?”

Solution

Starting with RB 14, it is possible to send email from ReportBuilder in HTML format and also include inline images inside the email message.

To do so, simply add the HTML source you would like as the email message to the EmailSettings.BodyHtml property (leaving the EmailSettings.Body property blank). For each image you would like to add, use the format “cid:[ImageName]” if you would like to attach the image file or a valid URL if the image in on-line.

Attached image example HTML: <img src=”cid:Image.jpg”>

 

Once the BodyHtml property has been defined, add the file location of any images you would like included to the EmailSettings.BodyHtmlAttachments property. This will attach the image(s) to the email message so they will display inline inside the email message.

Notes:

This feature is only available with the Indy 10 or the Extended MAPI plugins (no preview). Include the ppSMTPIndy10 or ppExtendedMAPI files respectively in the “uses” clause to register the plugin to be used.

Download: EmailHtmlInlineImage.zip

Sample Delphi code: