Power Automate: add a picture in an email

I will explain how to put a picture on the header/top or anywhere else (about an attachment, read Power Automate: add an attachment in an email). Before to start:

  • Image can be in PNG or JPG
  • Steps should be outside of a “control” or “condition” step
power automate power automate

After selecting the kind of flow I need, I click on the “+” to insert a new step:

power automate

In the “search” field, put “sharepoint get file content” to select this option:

power automate

NOTE: my picture is in sharepoint, if you have it in other cloud like onedrive, use/select the corresponding one

Fill the fields:

power automate

Click on the “+” then in the “search”, put “initialize” to select this option:

power automate

Fill the fields:

power automate
  • Name: put whatever I want, for my example “picturemail” (this name will be used for my email)
  • Type: select “string”
  • Value:
    • Put: <img src="data:image/jpeg;base64, "/> then click on the “space” then on “fx”
      power automate
    • Put: .$content then click at the beginning just before the dot
      power automate
    • Click on “dynamic content” then on “file content”. Once done, click on “add”
      power automate
    • Result: <img src="data:image/jpeg;base64,@{body('Get_file_content_using_path').$content} "/>
    • NOTE:
      • To specify the size, add “width="XXX" height="XXX"” like that:
        power automate
      • To put a link, add <a href="link">imagecode</a>:
        power automate

Alternatively, I can use “compose” instead of “initialize variable”. I will put <img src=' '/> then in the space, click on “fx”:

power automate

Put dataUri() and between the parenthesis, add “file content”:

power automate power automate

Result: <img src='dataUri(body('Get_file_content')) '/>

power automate

Click on the “+” then in the “search”, put “send email” to select this option:

power automate

Fill the fields and in the body, click on the “lightning” icon to select:

power automate power automate

Once done, click on “save” and “test”:

power automate

If all go well, this is my email:

power automate

Interesting Topics