Render HTML Base64 images

I am sending out SMTP emails with an HTML body that includes some embedded images using Base64Strings. The emails and images look perfect when viewing in-house in Outlook. When the emails are sent to an external account such as Gmail the images don’t display and all you can see in the Base64 strings. Is there a simply fix, or a better way to embed images into a HTML email body?

Thanks

Craig…

Let us know in detail how you embed the Base64 string image src value. Thanks

UPD1 -
lets also get mentioned the GMail typical behaviour of embedded base64 imgs vs. attached images and referenced inside a img tag

So here are the steps I go through to get the images embedded.

  1. Load the location of the image into a string variable

  2. Create a Byte Array variable and set as follows: System.IO.File.ReadAllBytes(TickImage)

  3. Create a String variable for the Base64 string as follows: Convert.ToBase64String(TickImageByteArray)

  4. Create a String variable for the HTML Tag as follows: “<img src=”“data:image/png;base64,” + TickImageBase64String + “”" width=““72"” height=”“72"”/>"

  5. There are 2 images, a Tick and a Cross which are processed the same above. I then determine based on data which one to display and copy that HTML Tag into a final String Variable called OverallResultImage. This is then added to the Email Body as follows:

“Annual Requirement Met” + “
” + OverallResultImage

I have included 2 attachments showing Outlook and Gmail.


Viewing in Outlook

Hi @craig.norton

Please check this

Cheers!!

Hi @lrtetala

I have watched that video previously and everything is setup in the same steps, however when viewing in gmail the images don’t appear.

kindly note also:


which was mentioned:

So can you try the alternates?