Logic Apps: How to send a well-formatted HTML Email notification with Office 365 Outlook connector

  • Sandro Pereira
  • Jan 26, 2020
  • 5 min read

The Challenge with Deprecated Logic Apps Actions

Microsoft has been discontinuing some actions for quite some time. In some cases, it even runs multiple versions side by side. Don’t get me wrong—this approach is understandable in a fast‑moving platform.

However, Microsoft has never been particularly strong at documentation. This was already true when software releases happened every two or three years. Today, in a world of continuous and rapid delivery, the problem is even more evident.

The Documentation Gap

As a result, a significant gap exists between the available features and how well they are documented.

In many situations:

  • Features exist, but lack proper explanations.
  • Behavior changes are undocumented.
  • Previous capabilities disappear without clear migration guidance.
Microsoft Office 365 Outlook connector documentation

What Deprecation Really Means in Logic Apps

When I say that Microsoft deprecated connection actions, I mean something very specific.

Microsoft didn’t just mark these actions as deprecated. Instead, it completely removed them from the Logic Apps designer. Using the two connectors mentioned earlier as an example, you can no longer see those deprecated actions in the designer at all.

This behavior makes it harder for developers to understand:

  • How to adapt existing logic going forward.
  • Why did an action disappear?
  • What replaced it?
Office 365 Outlook connector action on Logic App designer
SQL Server Connector on Logic App designer

But don’t be alarmed, your existing logic apps that still use these deprecated actions continue to work properly.

In this article, we will address the Office 365 Outlook connector, especially the Send an Email V2 action, since the Send an Email action is now deprecated. So the question here is:

#1 Azure Monitoring Platform

📝 One-Minute Brief

Explains how to send well‑formatted HTML email notifications from Azure Logic Apps using the Office 365 Outlook “Send an email (V2)” connector, including how to handle HTML content after the deprecation of the original action.

How to send a well-formatted custom HTML Email using the Send an Email V2 action available on the Office 365 Outlook connector?

I personally liked the Send an Email action 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.

Office 365 Outlook connector Send an email action shape

Quite simple to use and efficient.

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

  • Is HTML property was removed from this action.
Office 365 Outlook connector Send an email comparetion between versions

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, …)
Office 365 Outlook connector Send an email V2 action shape

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:

Office 365 Outlook connector Send an email V2 action shape

But the end result will not be what you expect:

Email result from the Office 365 Outlook connector Send an email V2 action

Unfortunately, in Power Automate Designer, we don’t have a Code View button (</>) in the Body property editor. I will be blogging about this feature soon on the Serverless360 blog. So, can we able to send a properly formatted, well-formatted HTML Email using the Send an email V2 action?

The answer is: unfortunately, at least in my opinion, we need to build the HTML in an action beforehand in a composite action or in a variable. And then put the compose output or variable as the send mail body property, and the action will render the output correctly as HTML.

To do that, we need:

  • On the Logic App designer, add the next step by clicking the +New step button
  • On the Choose an action window, enter Variables and select the action Initialize variable.
  • On the Variable action configuration:
    • On the Name property, type EmailBody.
    • On the Type property, specify the type as String.
    • On the Value property, leave it blank.
Initialize variable action on Logic App designer
  • On the Logic App designer, add the next step by clicking the +New step button
  • On the Choose an action window, enter Variables and select the action Set variable.
  • On the Variable action configuration:
    • On the Name property, select EmailBody variable.
    • On the Value property, type your custom HTML.
Set variable action on Logic App designer

Note: you can take, for example, this fancy HTML Template that I created specifically for this article here: HTML Notification Template to use Logic App or Power Automate Outlook connector, and not this basic HTML that you are seeing in the picture.

  • And then define directly on the Body editor (without switching to Code View) that the body will be the content of the variable we created earlier:
set body property variable on Office 365 Outlook connector Send an email V2 action

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

Correct Email output from the Office 365 Outlook connector Send an email V2 action

Thanks to Thiago Almeida for the help, and to Pedro Rosa for the HTML Template that helped me create this HTML Template, and, most importantly, for making it compatible with Outlook, because not all the stylesheets we can apply are compatible.

Hope this helps!

To know more about Logic Apps: Learn more

#1 Azure Monitoring Platform

Hope you find this helpful! If you liked the content or found it useful and would like to support me in writing more, consider buying (or helping to buy) a Star Wars Lego set for my son. 

Thanks for Buying me a coffe
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.

21 thoughts on “Logic Apps: How to send a well-formatted HTML Email notification with Office 365 Outlook connector”

  1. I have been looking for a creative way to set up a professionally looking notification. This is exactly what I was looking for. Thank you for sharing this information with us!

  2. Thank you for your post it has been very helpful. Would you do the same for graphs that you would like to email? I’m looking for a way to email performance graphs using logic apps

  3. I think this has been revised now, as there is a code button within automate’s simple email V2 connector – but this still does not work very well when sent to outlook. outlook seems to reject most html css styling from what we can see – no max-width on tables allowing centering of a table within the viewport, no border-radius… only simple styles like text and such are respected. it would be great if microsoft could bring all of their products together to offer a unified solution.

    1. I normally use an Azure Function to parse the error messages to the desired format and replacing unwanted characters.

  4. Hi what if i want to change the subject color red i tried with setting a variable but it displays the variable not the value

  5. Thanks you really much Sandro for taking the time to publish this really helpful article.

    This is the kind of content that would be worth including in the official documentation.

  6. Thanks for the post, really helpfull. As some poeple comments. This info should be in the official documentation.

  7. Hi this has been extremely helpful. Do you happen to have any examples or tutorials on how to embed “Alert Custom Details” into an email.

    I have a KQL query where I want to embed a few columns and their associated data into the email directly.

Leave a Reply

Your email address will not be published. Required fields are marked *

The Ultimate Cloud
Management Platform for Azure

Supercharge your Azure Cost Saving

Learn More
Turbo360 Widget

Back to Top