Embed Image in Send mail from an attachment
In this post, we’ll understand how to send the embed image in Send mail body in Azure LogicApps.
Question: I am receiving an email with an attachment that is an image (The same image is also in the body). I want to forward that image, but I can’t find a way to add that image to the body of “Send mail(V2)”.
More specific it’s the mail from the Power BI subscription, the default mail isn’t pretty, and would like to add custom text and so on to the mail sent out to consumers.
Solution: As per the question, we want to send the embedded image in the mail body using the “Send mail(V2)” action in Azure LogicApp.
- We have to convert the image content to Base64 because we can’t pass the plain content of the image.
- In Compose action we’ll covert the content as per requirement.
- Now in Send mail(V2) action, we can use the output of composing action. Let’s check the below steps with a screenshot;
Solution for embed Image in Send mail
Complete Workflow: Below image is the complete working workflow,
Step 1 — In the above image, I have created a “When a blob is added or modified (properties only) (V2)” trigger which will run every 3min to check if any new file is added/modified to Blob Storage.
Read this article if you want to learn how to create Azure Blob Storage Account and Upload a File
Step 2 — Get the content of the file added to Blob storage using “Get blob content (V2)” action.
Step 3 — Here, we have to convert the content to Base64 using the inbuilt function in “Compose” action. And add the details that you want to send in body.
Step 4 — Last “Send an email (V2)” action which will send the email with embedded image content.