Sending a beautifully formatted email from Power Automate (Flow)

updated March 10, 2020

I recently shared a winning use case for Office 365. Within this use case, I am using a flow in Power Automate to send beautifully formatted emails to our users. Something like:

formatted email from microsoft flow

Okay, maybe it’s not that beautiful, but it is colorful, has an image, and pops in comparison to black and white text only emails.

Using the Rich Text Editor in the Email Action

The Send Email actions include a rich text editor already, allows you to bold text, add some color, and format the email much like you can in Outlook.

rich text editor in flow action

That may suffice for your needs, but sometimes we need to send a fully formatted email, like my example above. That example wouldn’t be possible using the rich text editor approach. So let’s work around it and get this beautiful email sent!

Check out Outlook’s other sending email options here.

Power Automate sends formatted emails with ease

Inside the rich text editor, note the </> button. That button allows you to create exactly the email you want. Any HTML you want to put in there you can.

As long as you know HTML, you can send beautiful emails. DONE!

What if I don’t know HTML?

I know HTML but I didn’t want to write the HTML for this email. Call me lazy, or too busy, or just intuitive :D. Instead, here’s what I did, and what I suggest to you.

Create a new email in Outlook.

Style the email: add colors, content placeholders, images, tables, etc. For content placeholders, put something obvious like %%FULLNAME%%, %%LINK TO SOMETHING%%, %%MESSAGE%%, etc. Whatever data you expect the Flow to load for you. Something to make the text pop out to your eyes later on.

Email yourself the email.

Open the email you just sent to yourself in Outlook. Open it in a new window, not in the preview pane in your Inbox. Go to Message tab, then More Move Actions > Other Actions > View Source. It’s kind of hidden:

view source of email.png

Don’t be scared! If you don’t know HTML, the resulting action of clicking above might have your eyes hurting. That’s OK!

You should see something like this:html source of email.png

Look for your content placeholders, I see mine, %%FULL NAME%%, right about halfway down. What’s all that other stuff on the page? HTML! Don’t worry about it.

NOTE make sure to start with <html and end with </html>. You may get other message header details in there, ignore that, just copy what’s between <html... </html>

Click the </> button in the rich text editor and paste in this content.

Now replace your content placeholders with dynamic values from Flow!

That’s it

Images are tricky

A quick note on images. Outlook takes the image you included in your email and converts it to a string, to plain text. I found copy/pasting this didn’t work in Flow. I think the text ends up being too long in this action and it breaks.

Instead, what you should do is upload the image to the cloud. I used our marketing system Pardot, but you could upload it to a Google Drive, OneDrive for Business, a blog site, anywhere. Get the anonymous visitor URL to the image itself, and swap that out for the image.

Look for <image src=”ab2md3m… in the HTML and change the value of the src property to the URL of the image. Your src should look like <image src=”https://url/to/your/image.png&#8221; />.

Check out this YouTube video for using an image from a SharePoint library: https://www.youtube.com/watch?v=sZjZyBVhPIc.

That’s it!

I hope this little trick works for you. Alternatively, you could find a WYSIWYG editor somewhere and format your email and then copy/paste that HTML as well. I find, that since the email was made in Outlook, its source is very Outlook friendly.

43 thoughts on “Sending a beautifully formatted email from Power Automate (Flow)

Add yours

  1. I just can’t seem to get the image to display. I tried from my SharePoint page, I tried from my OneDrive. I even tried from Google Drive. In all cases I changed the settings to share with anyone with link. Perhaps I’m missing the step on how to locate an anonymous visitor url?

    1. To insert image from Sharepoint in the flow:
      1. after trigger->add action: get content from file (sharepoint) – use link to SP page and choose the file-
      2. add action: compose (data operation)->click on add dynamic content -> in expressions tab type: base64 and from dynamic content add “get content from file” so it should look like this: base64(outputs(Get file content)?(body))
      3. in action “send email” in the body use code:
      and that should do the trick.

  2. Very helpful. Thank you.
    Do you have any advice on creating html forms in the email? And capturing the responses in power automate flows?

    1. Creating an HTML form actually in the email itself? I don’t think that’s possible. HTML in Email is VERY limiting, and there are no scripting options. You’ll need to host the form elsewhere, like Microsoft Forms, then automate from there (I have some posts on that too).

  3. This is exactly what I want to do with my email. I tried this and when I tested my flow. My flow worked but when I got the email I had the error on the email of “the linked image cannot be displayed. The file may have been moved, renamed, or deleted. Verify that the link points to the correct file and location”. This was over every image (shape, text box, and logo) Could you help me out.

      1. I am inserting the logo from my device, stored in my OneDrive. It is also giving me an error for just the text box and shapes

        1. Inserting it in the flow? For the image to work correctly, it has to be either 1) hosted publically and you reference it via its URL or 2) converted to a base64 array and embedded in the email. #2 is how Outlook does it. If you embed the image in an email in Outlook and email yourself, using the technique above, you should be able to get the necessary array for the image to add to flow.

  4. Everything worked great, except for inserting images. The instructions about changing the value of the src property to the URL of the image are not clear.

    1. I updated the text a little, but unsure what’s not clear about it. What part are you struggling with? If you’d like, you can email me at david.lozzi at slalom.com and we can discuss further. Thanks!

  5. How do you turn OFF html formatting inside the Flow editor? I turned it on, but now I can’t get back to the regular text editing tools?

    1. Sorry, I’m not following exactly. If you’d like, email me at david.lozzi at slalom.com with some screenshots and I’ll see how I can help.

  6. This is an excellent and very helpful walk-through! I’m a bit unfamiliar with HTML, so the one thing I think would be great to know is how to get those image URLs if they are saved to your computer instead of finding them on the internet. Thanks so much!

    1. You won’t be able to get the image URLs until they’re saved on the internet somewhere. Can’t use them locally :(
      However, if you’re using DropBox or OneDrive, something similar, you can throw them up there and get the anonymous link to them, that _should_ work fine.

  7. Microsoft recently deprecated the email connector with the advanced options for html. Are you aware of a revised connector with this capability?

    1. Yes! You can’t. ;)

      Emails cant use an authenticated source for images. Maybe if you did an anonymous link to OneDrive, that may work. I find I have to put the images into a public location like my blog or git. Sorry I wish there was a better story.

  8. This is a great tip. Previously I was creating Word templates, populating them, converting them to PDFs and then sending them via e-mail. This cuts out all those steps. Thanks so much!!!

  9. This is great!
    I used to make a better looking table in the email sent from flow.
    However, I have a problem that my auto-signature (which normally is in a table with no borders) also gets the style of the table, which I do not want.
    How can I end the style of the content that comes from flow, so my autosignature keeps its original style?

  10. This worked great for me…I can see a beautiful logo in my flow generate email, however, others only see the alt text and box with a red x. I cannot find anything online to help me figure out why I can see it, but others cannot. Also how do I find the anonymous visitors URL?

    1. Where is the logo image stored? If it’s in SP, then the user would have to authenticate against SharePoint and then they can see it. Email client, like Outlook, won’t prompt for authentication.

  11. This was amazing and beautiful. How do I clean up the brackets from the form field?

    RESPONSE DATE: 11/26/2018 8:34:14 AM
    FIRST CONTACT GUEST CARD ORIGIN: by Email
    CONTACTED BY: Justin Jones
    MARKETING SOURCE: [“Sidewalk sign”]
    PURPOSE OF THIS IN PERSON VISIT:
    PREVIOUS CONTACT HISTORY: Nope, this is our first encounter.
    TOUR DATE APPOINTMENT REQUESTED: 2018-11-26
    COMPETITOR TOUR:

Leave a Reply

Powered by WordPress.com.

Up ↑

%d bloggers like this: