This week I had to convert a few dozen Nintex workflows to Microsoft flow for a migration we are doing. Most of these workflows had some sort of email to a department or an external vendor.
The default Exchange email connector can handle HTML but you need to add the HTML to the email body. Adding the header and footer to every email can be done, but maintaining this is a nightmare so we did some thinking and came up with this solution.
- Create a SharePoint Custom list with an extra column
- Get the content of this SharePoint list item in the flow. We have two of them, one for the header and one for the footer
- Add the content of this extra column to your mail body.
We choose to only add one extra column so we are more flexible in combining headers and footers.
These are the steps to take
Create custom list
In SharePoint create a new custom list and add an extra column called ‘Content’ with type ‘Multiple lines of text’ and disable ‘rich text’
This list can be filled with a title and the mail content like a default header and footer or maybe a signature of a department. Use any HTML code you want
Create a new flow
Now that we have the list we can go to flow and create a new flow that is going to use our template
In flow add a new action and search for “Get item” and add it.
Fill in the URL and select the list that you have created in the first step.
Unfortunately, this action only works with ID’s, so you need to get the ID of the SharePoint item. For each item that you need in your email body add an action.
Rename the action to a name that makes sense in the flow, this will help you find the correct content
Now you can add a “send an email” action to your flow. In the Body field add dynamic content and search for the ‘Content’ field
As you can see, multiple items get found, this is the reason to name your actions.
Also important to change the property ‘Is HTML’ to ‘Yes’
Now your flow is ready to test.
There are some alternatives for this approach like Plumsail (https://plumsail.com/docs/actions/v1.x/flow/actions/document-processing.html#create-html-from-template)