Image Rendering Issue In Outlook Through Microsoft Flows (Office 365)

Recently, while working on a SharePoint Online (Office 365) project, I came across a very interesting task, i.e., to send anniversary and birthday emailers to the users. This scheduling needs to happen daily based on an individual's birthday or anniversary date. 
 
Task

Send Anniversary and Birthday Emailers. Also, the images are random and every user must receive a different birthday image.
 
Looking at this task, I thought it’s a very common task and in every organization, developers will be doing this kind of activities. So below are the approaches,
 
Approach 1
 
My first approach for implementing this was to develop a Console Application and use Managed Client side object model (CSOM) code. Then this console application will be hosted on a Windows Server. However, this approach had a dependency on Windows Server and the client refused to use this approach.
 
Approach 2
 
The second approach was to schedule the Console Application as a Web Job on Microsoft Azure, however, this approach was also not possible because the client didn’t have an Azure subscription.
 
Approach 3 (Most Appropriate Approach)
 
The last approach was to use Microsoft Flows in Office 365. In Microsoft Flows, we have an action called “Recurrence” through which we can schedule our tasks. So, I used this approach, however using this approach again introduced the following challenges,

Using the SharePoint Document Library for saving the images

Challenge 

The image is not visible in the email body in Outlook 2013 or Outlook 2016.
 
NOTE
“ISHTML” option in Microsoft Flows was checked, so this was not the issue. Also, from the firewall policy point (from the customer), the settings in Outlook were also checked (as shown below).

Image Rendering Issue In Outlook Through Microsoft Flows

Image Rendering Issue In Outlook Through Microsoft Flows
 
Image Rendering Issue In Outlook Through Microsoft Flows 
 
NOTE
I checked with checking the above checkbox also, but the issue remained the same.
 
Since there were random images, firstly I saved the images in SharePoint document library and used <img> tag in MS Flows.

Image Rendering Issue In Outlook Through Microsoft Flows
 
Using this approach, the image was visible in Outlook Online (in the browser), however, it was not visible in Outlook client (which come with Microsoft Office). I tested it in Outlook 2013 and Outlook 2016, but the image was not visible as shown below,

Image Rendering Issue In Outlook Through Microsoft Flows
Fig: Output in Outlook Online (in browser – Image is visible in email body)
 
Image Rendering Issue In Outlook Through Microsoft Flows 
Fig: Output in Outlook Client (Image not visible in email body)
  1. Using Office 365 OneDrive for business for saving the images
    With this way of storing the images, I was getting the same above error in which  the image was not shown in an email in Outlook client. I also used OneDrive embedding image, but the issue remained the same.

  2. Using Google Drive and DropBox (open source CDN’s) for saving the images
    With this way of storing the images, the issue remained the same.
 
Solution
 
Earlier, we tried the following (the below approached didn’t work):-
  • Using SharePoint Document Library (Picture Library) as the image source (<img src>).
  • Using images from List Item Attachment
  • Converting SharePoint Image Content into the Binary format and set as an image source
  • Directly setting image source as a base 64 string
  • Using image URL from Google Drive/One Drive and image is shared publically
All the above approaches didn’t work and finally, I found the below solution which worked,
 
Image Rendering Issue In Outlook Through Microsoft Flows 
 
Send the image as an attachment in Microsoft Flows. We need both file content as well as reference, to be passed as shown in above image. The images are saved in SharePoint Library only.
 
By using the above approach, the users received the image in the email body (as shown below), both in Outlook Online and Outlook client.
 
Image Rendering Issue In Outlook Through Microsoft Flows 
 
Summary
 
It’s a very common task of sending the scheduled/periodic emails in SharePoint. In SharePoint Online (Office 365), we can implement the same using Microsoft Flows. In this article, I tried to demonstrate all the possibilities for sending an email with an image (in email body) via MS Flows. Hope this article will surely help many.


Similar Articles