Skip to content

Power Automate

3 Ways Power Automate Can Embed An Image In Email

3 Ways Power Automate Can Embed An Image In Email Posted by - Matthew Devaney on - March 3, 2024 34 Comments Want Power Automate to embed an image in email? ...

Matthew Devaney
Published
Reading time
5 min read

Before you start

Is this guide for you?

Best entry point
Power Automate
Time investment
5 min read

Imported reference from Matthew Devaney's blog for learning purposes. Original: https://www.matthewdevaney.com/easiest-power-automate-embed-image-in-email-method/. Author: Matthew Devaney.

3 Ways Power Automate Can Embed An Image In Email Posted by - Matthew Devaney on - March 3, 2024 34 Comments

Want Power Automate to embed an image in email? I’ve done the research and I will show you the best ways to do it. Displaying an image properly in all email client is not an easy task. My goal was to find the most compatible and the cleanest method possible while still using standard licensing. And if you have a premium license I’ve got a neat trick to share with you that uses the Microsoft Graph API . Table of Contents

Introduction: The Email With An Image Automation Setup The SharePoint Document Library

Method #1: Embed Image In Email Using Content ID

Method #2: Embed Image In Email Using Data URI

Method #3: Embed Image In Email Using Hidden Content ID

Introduction: The Email With An Image Automation

We will use Power Automate to send an email with an embedded image. The image appears in the body of the email instead of as an attachment. Setup The SharePoint Document Library

The examples in this article use an image stored in a SharePoint document library. Create a new document library named Email Embed Images and add an image to it.

To follow along with the examples use this image named Business-Cat.jpg .

Method #1: Embed Image In Email Using Content ID

The most reliable way to embed an image in an email with a standard license is using Content-IDs (CID). It is supported by all versions of Outlook and even works in Gmail.

✅ Desktop Outlook ✅ Desktop Outlook (New) ✅ iOS Outlook ✅ Outlook Web ✅ Gmail

This Power Automate flow gets the image file content from SharePoint and then adds as an attachment to the email. Then the email displays the image in the body of the email by making a reference to it in an IMG tag . The image path (src) is prefixed CID: and matches the attachment name.

Use this code in the Data Operations – Compose action. < img src = 'cid:Business-Cat.jpg' /> Code language: HTML, XML ( xml )

Test the flow by sending an email. The email appears with an image displaying in the body.

The only drawback of this the Content ID method is it displays an attachment icon. This is misleading to the email recipient because there are no downloadable attachments in the email.

Method #2: Embed Image In Email Using Data URI

Embedding the image as Base64 is the cleanest method because there is no attachment image beside the email. However, not all email clients have support for Base64. Only use it if you have a standard license and you know the recipient will use a compatible email client.

✅ Desktop Outlook ✅ Desktop Outlook (New) ✅ iOS Outlook ❌ Outlook Web ❌ Gmail

The Power Automate flow gets the image content from SharePoint and converts it to Base64 using the dataURI function. The Base64 is placed inside of an IMG tag and displayed in the body of the email.

Use this code in the Data Operations – Compose action. < img src = '@{dataUri(body('

Get_file_content_using_path:_Embed_Image '))}' /> Code language: HTML, XML ( xml )

Run the flow to send an email. The result looks like this:

No attachment icon is shown when embedding images as Base64.

Method #3: Embed Image In Email Using Hidden Content ID

A premium-licensed flow is the best method because it can send embedded images that are fully compatible with all email clients and hide the attachment icon. It achieves this by using both Content IDs and inline email attachments.

✅ Desktop Outlook ✅ Desktop Outlook (New) ✅ iOS Outlook ✅ Outlook Web ✅ Gmail

This flow is the same as Method #1 except it replaces the Send Email action with an HTTP with Microsoft Entra ID (preauthorized) – Invoke An HTTP Request action. Then it creates and sends the email using the Microsoft Graph API . The reason we use the Graph API is it gives us the ability to set an attachment as inline.

When creating the connection to Microsoft Entra ID use https://graph.microsoft.com as the Base Resource URL and Azure AD Resource .

Write this code in the Data Operations – Compose action. < img src = 'cid:Business-Cat.jpg' /> Code language: HTML, XML ( xml )

Choose the POST method and use this URI for the Invoke an HTTP Request action.

https: //graph.microsoft.com/v1.0/me/sendMail Code language: JavaScript ( javascript )

Use this key-value pairing in the request headers. Key Value Content-type application/json

Copy and paste this code into the body of the request. The isInline property of the attachment makes it hidden. { "message" : {

"subject" : "Email With Embedded Image (Hidden Content ID Method)" , "body" : { "contentType" : "HTML" ,

"content" : "@{outputs('Compose:_Image_Tag_With_Content_ID')}" }, "toRecipients" : [ { "emailAddress" : { "address" : " [email protected] " } } ], "attachments" : [ {

"@odata.type" : "#microsoft.graph.fileAttachment" , "name" : "Business-Cat.jpg" ,

"contentType" : "@{body('Get_file_content_using_path:_Embed_Image')?['$content-type']}" ,

"contentBytes" : "@{body('Get_file_content_using_path:_Embed_Image')?['$content']}" , "isInline" : true } ] } } Code language: JSON / JSON with Comments ( json )

Test the flow. The email arrives in the recipients inbox and shows an embedded image in the body.

There is no attachment icon showing for the email. Did You Enjoy This Article? 😺

Subscribe to get new Copilot Studio articles sent to your inbox each week for FREE Enter your email address Sign Me Up Questions?

If you have any questions or feedback about 3 Ways Power Automate Can Embed An Image In Email please leave a message in the comments section below. You can post using your email address and are not required to create an account to join the discussion. Matthew Devaney Power Automate

Save Docusign Document To SharePoint With Power Automate

Share this

Tagged

Power Automate

Have a Microsoft 365 topic idea?

Share article suggestions, community session ideas, corrections, or real-world scenarios for future nextM365 learning notes.

Suggest a topic

Keep learning Microsoft 365

Explore more practical guides for SharePoint, Power Platform, Copilot Studio, migration, automation, governance, and security.

Continue learning

Next action

What to do next

Browse all tutorials →