Leveraging SendEmailFromTemplate to Send Emails to Unresolved Addresses

Introduction
While working on Dynamics 365 CE we often need to streamline communication processes using Power Automate. While we want to send emails to our customer, one effective way to do this is by using email templates. Email templates streamline the communication process by providing users with a standardized framework for creating emails, ensuring brand consistency and saving time. These templates can be personalized with dynamic content, such as recipient names, organization details, or specific messaging, making them versatile tools for various communication scenarios. In our last two posts we discussed of using email template and how to bring related entity attribute and place them in the email body, you find links below, In this blog post, we’ll explore how to leverage SendEmailFromTemplate to send emails to unresolved addresses using Power Automate.

Details
Let’s say in Dynamics 365 CE we want to send email to unresolved email addresses, which means there is not record in Dynamics 365 CE which having these email address. To send email to unresolved email address first we need to enable below setting under Email, so navigate to Settings->Administration->System Setting and enable it.

sendemail1

Let’s assume in our Event custom entity we have field called External Recipients field where we have some unresolved email address used, it’s a text field so that user can enter multiple email address in the following format: test@test.com;test123@test.com
We have setup a Queue in our system ‘Do Not Reply’ from where we will sending email to these unresolved email address and as discussed in earlier posts we are using email template to create this email so let’s start creating our power automate.

We want to send email when event is created so let’s add a trigger when new record is added to event and initialize variables like below to store external recipients emails, queue id and party list array:
sendemail3
Next we need to add list action to get Queue and Email Template based on the name, while we have it, we can set Queue id using expression like in below screenshot.
sendemail4
Once we have queue id, we will append this under from partylist.
sendemail5
In the Compose action, I am suing split function split(triggerOutputs()?[‘body/him_externalrecipients’],’;’) and after that we are setting output to the external recipient email array.

Once we have email addresses, we need to setup to partylist.
sendemail6

And finally we need to use SendEmailFromTemplate action to send email using template we fetched and create email like below:
sendemail7
And when we will test it, it will generate email like below:
sendemail8

Summary
We learned how to utilize Dynamics 365 CE templates to send emails to unresolved addresses. By following the steps outlined in this blog post and leveraging the capabilities of Power Automate, you can streamline communication processes and ensure that important messages reach their intended recipients effectively.

Hope it will help someone !!
Keep learning and Keep Sharing !!

Creating Email Template for Custom Entities in Dynamics 365 CE
Getting Additional Fields from Lookup while using Email Template

Leave a Reply

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