Power Automate – Send email with embeded image

Introduction

In this post, let us learn how we can send email with image in Power Automate. Most of us think that what is the difficulty in sending an image in an email? But many of the emails with image can’t be opened in mobile devices because the image is linked and its not embed. We will see the option of sending an email with embeded images by leveraging SharePoint or Onedrive.

Let’s start building Power Automate Flow

For demo purpose, I had used the manual trigger but it can be automated based on the business requirement.

Get file content using path – Get the image as binary

The first action is to get the image. In this demo, I have used the SharePoint action to get the image from SiteAssets library. The same approach can be used in combination with OneDrive using Get file content using path for OneDrive. The output of the action is the binary content of the file.

Compose

This action is used to generate the base64 enoced-version to embed the image. The input to the base64 method has to be content from the previous action. The method should be like mentioned below

base64(outputs('Get_file_content_using_path')?['body'])

Send an email notification (V3) – To send email with image

The key change that we need to do is to navigate to the Code View of the Body content and add an img tag with src attribute as a data image. The other attributes like width, height and alt can still be given to the image to make the image adapt to the email content.

<img src="data:image/jpg;base64, <base64 output" width="100" height="100" alt="demo image" />

Conculssion & What’s next?

We have come to the end of the post, the flow that we learned above is an option to embed the image in the email and send using Power Automate. Since the image is embeded, its viewable in web, outlook client in both desktop and mobile.

Please leave your comments and also let me know if you have any issues or any scenario that you want me to implement using Power Automate.

I hope you enjoy reading the post, see you soon in another post.

Cheers. Happy Flowing…

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google photo

You are commenting using your Google account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s