Developer Forum »
Send emails with images?
9 posts

Hello

In our project we need to be able to send various types of emails whose contents are defined by the end user in html properties, and the content may also include images.
I'm using the WAFSession.SendEmail method, and I have the image as an ImageFile object and also (of course) the corresponding img tag in the html property.
I guess I have to send the image file as an attachment, but I can't figure out how to do it using the attachedFiles list of the SendEmail method.
Hope you can help me!

Regards,
Guro

181 posts

Hi!

The common way of doing this is to just send the html with the img tags in them, but make the links to the files absolute first. That means that the email client will load the images from the site.

Code example:

HtmlNode node = new HtmlNode(templateHtml);                        
node.MakeAllReferencesAbsolute(baseUri);

 

9 posts

Thanks!

1