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 customers, 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 using an email template and how to bring related entity attributes 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.
Enabling settings for sending emails to unresolved addresses
Let’s say in Dynamics 365 CE we want to send emails to unresolved email addresses, which means there is no record in Dynamics 365 CE which having these email addresses. To send an email to an unresolved email address first we need to enable the below setting under Email, so navigate to Settings->Administration->System Setting and enable it.
Let’s assume in our Event custom entity we have a field called External Recipients field where we have some unresolved email addresses used, it’s a text field so that the user can enter multiple email addresses in the following format. [email protected];[email protected]
Setting up email template and queue
We have set up a Queue in our system ‘Do Not Reply’ from where we will send emails to these unresolved email addresses and as discussed in earlier posts we are using an email template to create this email so let’s start creating our power to automate.
We want to send an email when the event is created so let’s add a trigger when a new record is added to the event and initialize variables like the below to store external recipients' emails, queue ID, and party-list array.
Next, we need to add a list action to get Queue and Email Template based on the name, while we have it, we can set Queue ID using an expression like in the below screenshot.
Once we have the queue ID, we will append this under from party.
In the Compose action, I am using 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 set up to party list.
Finally, we need to use the Email From Template action to send emails using a template we fetched and create an email like the one below.
When we test it, it will generate an email like below.
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 !!