Power Automate: Embed an image in an email

It sounds easy but believe me it is not so easy that it sounds like. There is no direct way that you can embed an image when you are drafting “Send Email” action even when you are planning to use HTML code in email body. There is a way to add a Image html tag but question is what will be the URL/SRC for same. Suppose you want to place image url which is exposed on internet, accessibility set to public, in that case you saved your time. Just use the URL in image tag and it will work.

So just wanted to mention one more important thing here. Email can we viewed by multiple means: MS Outlook or from Browser. The behavior in both the cases will be different. I have observed the behavior that sometimes when email is opened using browser it renders images perfectly but when same email was opened using MS Outlook app, images shows just cross marks. May be due to the reason the images can easily be accessible using browser but Outlook it may require some extra steps.

After spending two or three days, trying different options, I finally got a solution which works in all cases.


Using Microsoft Flow, trigger sending of an email with an embedded image.

  • The image will be stored in a SharePoint Library/One drive
  • We will assume you have already created connects to:
    • Office 365 Outlook
    • SharePoint/Outlook


  1. Create a new Flow:
    1. Select: +New Instant—from blank
    2. Click: Manually trigger a flow
  2. Add the 1st actions:
    1. Search for SharePoint > Get file content using path
    2. Select the action
    3. Site Address: either select or ‘enter custom value’
    4. File Path: enter the path from the site collection (e.g. ‘/Style%20Library/DemoFile/EmailCompanyLogo.jpg’)
  3. Add the 2nd actions:
    1. Search for Variables > Initialize variable
    2. Select the action
    3. Name: Enter ImageTag
    4. Type: Select String
    5. Value: This is the trick bit!*
      1. Enter: <img src=”data:image/jpeg;base64,” alt=”CompanyLogo” />
      2. Next click between ‘64,‘ and ‘” alt
      3. Add dynamic content
      4. Select: Expression fx
      5. Enter .$content
      6. Placing you cursor before the .$content click: Dynamic content
      7. Locate and select File Content
      8. Click OK
  4. Add the 3rd and last actions:
    1. Search for Office 365 Outlook > Send an email
    2. Select the action
    3. To: enter your email address
    4. Subject: Microsoft Flow: How to embed an image in an email
    5. Body: <p>This is my test email, you should see an image below</p><p></p>
    6. Click between the last <p></p> tags
    7. Click: Add dynamic content
    8. Locate and select the ImageTag variable
    9. Is HTML: Select Yes(Note: you may not able to find this option in new versions of the action. In new versions, there is option looks like “</>” at top right corner of the action which converts body in html. Here is the screen shot for same)

Save the Flow

*Here is the full code/expression:

<img src="data:image/jpeg;base64,@{body('Get_file_content_using_path')['$content']}" alt="My Image" />

Note: The other way to implement the same requirement is to attach as attachment to the email action. Provide file content as Attachment Content and image will be rendered as usual.

Please feel free to hit like button in case you find the content of this bog helpful.

Happy PowerAutomating !!

18 thoughts on “Power Automate: Embed an image in an email

  1. Appreciate you posting this and the level of detail you have included. Unfortunately, when the workflow runs an image with a question is included instead of the actual image. These are the steps and configuration:
    1. Added ‘Get file content used path’ action. Linked to image in SharePoint library. Ensured the account connected to the workflow had access.
    2. Added ‘Initialize variable’ action. Configuration includes Name: ImageTag, Type: String, Value: .
    3. Added ‘ImageTag’ variable to email between


    and ensured HTML was turned on.


    1. Hi Joshua,

      As was mentioned earlier, Power Automate adds additional quotes, I solved this by removing all quotes from the ‘initialize variable’ value leaving everything as src=data:image/… and alt=MyImage

      Hope it helps,

      Liked by 1 person

        1. Can you please specify from where we need to remove Quotes OR else put the original format I which we need to specify the expression.
          Thank You


  2. Hi Joshua, thanks for trying this solution. It must be issue with quotes. You can check with flow history and check if images content is properly fetched or not. If still that solution does not work then there is one more way to implement this.

    Another solution will be, you just need to expand attachment sections and provide image name and content as an attachment to the email. Then under body just try to place the content and it should work !


  3. Not Sure why the code above did not paste, probably because of html tags, please add opening closing brackets

    Opening Bracket img src=data:image/jpeg;base64,@{body(‘Get_file_content’)[‘$content’]} alt=MyImage / Closing Bracket


    1. @sreenu, this option is there when you open advanced option of “Send Email” action. But don’t worry if you do not able to see this option under advanced options just make sure html is supported when you send email. Hint: MS has added button in send email actions for html body content.


  4. I could not locate the below option? Could you please point where this option located?
    – Is HTML: Select Yes

    Also, inside Initialize variable, in the name text box, do I need to manually type the name as “ImageTag” in the textbox?


    1. Hi Santos, Thanks for trying my solution. Yes, MS has updated the action now IsHTML is removed. There is option looks like “” at top right corner of the action which converts body in html.
      Also, about ImageTag, it is just a variable name you can type it same or type whatever name you like.


  5. It doesn’t work for me at all. $content is not available for me to choose. Mine is the GIF file and it works on either Web browser or the desktop version depending on who I send it to. I have tried to solve this but so far is having no luck.


  6. Hi. Thanks for this solution. After some minor changes, I got this working. I have another requirement you might like to consider. I put two images into an email. One was automatically resized to the full width of the email by Outlook. The other was fine and not resized. Any ideas?


    1. Hi Dave, Thanks for trying this. About the size of the image, I think it should be dependent on resolution(height and width) of the image. I have a workaround that you can try here is by adding specific height and width in the image tag. Here is an example of what I am saying:

      I did not tested this but logically it should work. Wish you luck !


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

This site uses Akismet to reduce spam. Learn how your comment data is processed.