Power Automate Outlook Connector: Custom HTML Email notification
← Return To Home

Send Custom HTML Email Notification with Power Automate Outlook Connector

Two years ago, I wrote a similar post on Microsoft Flow: How to pass the SQL data table results in a Markdown-formatted table into an Email notification or Approval Requests. It is still quite up to date, i.e., it is an excellent solution that you can still use today. The only problem with that article is that I was using “send an email” action in Power Automate Outlook connector that is currently deprecated.

This action was great in my perspective because we were able to directly put HTML code on the body property and define that the email body format would be HTML by setting the property Is HTML to true.

Deprecated Power Automate Outlook connector

Power Automate Outlook connector

Quite simple to use and efficient.

However, Send an email (V2) action has totally different behaviour. First of all, it owns fewer properties:

  • Is HTML property was removed from this action

And a completely new look and feel of the Body property as you see in the picture below:

  • With a powerful editor similar to what we have in our office tools (Word, Outlook, …)

Power Automate Outlook connector

But that also means that we no longer have the possibility to directly insert HTML code into the body property of the message, as we did earlier with the previous version. Well, we can write HTML code on the body of this action:

Power Automate Outlook connector

But the end result will not be what you expect:

Sandro pereira email

Luckily for us, on the Power Automate designer, we will see a Code View button (</>)

Power Automate Outlook connector

 

If you click it, you will see that everything that we will put directly on the body editor will be considered as text:

Power Automate Outlook connector

So, if we want to send a well-formatted custom HTML email we have two options:

  • Using the View Code feature on the Body Editor
  • Using a support Variable
Option 1: Using the View Code feature on the Body Editor 

On the Send an Email (V2) Body editor, switch to View Code and place the custom HTML code inside:

Power Automate Outlook connector

Doing that, you will notice that the editor will be blocked on the view code viewer.

If you test it now, you will see that you will be receiving a well-formatted HTML email in your mailbox:

Sandro Pereira email

This approach is good if you just want to send a static email or with a pre-defined structure, not subject to changes in runtime.

Option 2: Using a support Variable

With this approach, you need to create a Variable and put the entire code inside that variable:

Then define directly on the Body editor (without switching to Code View) that the body will be the content of the Variable we created:

power Automate Outlook connector

You will see that you will also be receiving a well-formatted HTML email on your mailbox:

Sandro Pereira email

This approach will be better for dynamic body structures that you need to build based on some inputs of external systems.

Hope this helps!

Author: Sandro Pereira

Sandro Pereira lives in Portugal and works as a consultant at DevScope. In the past years, he has been working on implementing Integration scenarios both on-premises and cloud for various clients, each with different scenarios from a technical point of view, size, and criticality, using Microsoft Azure, Microsoft BizTalk Server and different technologies like AS2, EDI, RosettaNet, SAP, TIBCO etc. He is a regular blogger, international speaker, and technical reviewer of several BizTalk books all focused on Integration. He is also the author of the book “BizTalk Mapping Patterns & Best Practices”. He has been awarded MVP since 2011 for his contributions to the integration community.