How to Embed an Image in Emails from Power Automate

Do you need to embed an image in your emails sent from a flow?

An embedded image is one that is included within the body of an email message and is displayed with the email text. Embedding an image inside your emails is a nice visual touch, but it can also help make them more prominent instead of just adding them as attachments.

There is no easy way to embed an image from the flow builder user interface In Power Automate. This will require a bit of work to get the result.

This post is going to show you how to get a picture to display in the body of your emails instead of as an attachment when sending an email from Power Automate.

Get Image Content from SharePoint

The first task is to get the image you want to embed into the flow.

This can be done using the Get file content action from the SharePoint connector.

In the Get file content action, you will be able to select the SharePoint Site Address from a dropdown list and then select the file in the File Identifier field using the small folder icon.

When you run this action in a flow, you will get the content type and the content.

In order to embed this image in the email, you will need the base 64 representation of the image which is exactly the $content part of the output.

@{body('Get_file_content')}

However, when you try and reference this action with dynamic content, you will not be able to get only the content part of the output. Instead, you only have access to the entire body of the output for the Get file content action.

@{body('Get_file_content')['$content']}

You can reference the base 64 $content string by appending ['$content'] it onto the end of the body expression as shown above.

This is what will be used in the email!

Send an Email with Code View

Now that you have your image content you can add an action to send an email.

Add the Send an email (V2) action from the Outlook connector.

In order to add the image to the body of the email, you need to enable the Code View mode. This will allow you to write the email body in HTML.

Use the IMG Tag in the Email Body

Add your email recipients in the To field and some text into the Subject.

<img src="data:image/jpeg;base64,@{body('Get_file_content')['$content']}" alt="website logo" width="356" height="80"/>

Now you create the text in the Body of your email. Add the above image HTML tag anywhere you want the image to appear in your email body.

The image tag source is the base 64 representation of your image file.

You will need to adjust the height and width part of the image tag width="356" height="80" based on how large you want your image to appear and the aspect ratio you need. But you can also delete these and let the email render the size for you.

Conclusions

Adding an image in your email body is a common task when sending emails and you’ll likely want to do the same when sending emails from Power Automate.

This can be done by getting the image content and inserting it in the email body using the code view.

Have you used this technique for your Power Automate emails yet? Let me know in the comments!

About the Author

John MacDougall

John MacDougall

John is a Microsoft MVP and freelance consultant and trainer specializing in Excel, Power BI, Power Automate, Power Apps and SharePoint. You can find other interesting articles from John on his blog or YouTube channel.

Related Articles

Comments

4 Comments

  1. Prabhakar

    Is it possible to send SharePoint list imges in outlook using Power automate flow.

    In the html table format

  2. Andrea

    This is great, John. I’ll give it a go. Thanks 🙂

  3. Konstantin

    Hi John,
    Is there an option to insert a content from other file to email, for example, to embed pdf content to email body?

    • John MacDougall

      You can attach files, but I’m not sure you can embed. Tbh, I’m not sure how you would do that outside of power automate, or if you can.

Get the Latest Tech Tips

Write For Us

Are you a tech enthusiast with a talent for writing great content? Come write for us!

Follow Us

Follow us on social media to stay up to date with the latest in tech!