top of page

Quick and easy way to send emails to a distribution list from within power apps.

  • Writer: ryangaming2k14
    ryangaming2k14
  • Oct 23, 2024
  • 3 min read

Updated: Oct 23, 2024




I find that a common requirement on projects is where the client requires the ability to send an email to a group of users in one go, rather than separately as this is tedious and time consuming. As there are many ways to do this, your solution depends on what the client is looking for exactly and what they want to achieve.

In cases where you don't want to use a complex Power Automate flow, or D365 customer engagement marketing list functionality is not readily available, or even when you do not want to bill many hours for consultants to be working, this setup should take about 10 minutes for any maker, perhaps extra for longer lists of email addresses.


Note:

M365 minimum roles required: Office Administrator, Power Platform Administrator

Dataverse permissions required: System Customiser role with create, read, write, append permissions to at least the Contact and perhaps the Email table.

Licences required: Any Power Apps/D365 license, and any M365 license providing a valid Exchange mailbox for a user.



Step 1: Creating the M365 distribution list

Go to the M365 Admin Centre. Navigate to the "Teams & Groups" area and select the "Distribution Lists" tab. Run through the steps to create a Distribution List here and add the appropriate users or standalone email addresses into it. Take a note of the email address you give to the list itself.


Step 2: Creating a Contact in your model-driven app to represent the distribution list

Go to your app and create a Contact, giving it an appropriate name (e.g. "DL - {Your Distribution List Name}" - starting with DL is a way to keep them ordered correctly in views, or you could do this by giving the contact a type or a two-option value to mark it as a distribution list contact).

Set the Primary Email Address of the contact to the email address of your M365 distribution list.


Step 3: Testing

For this step, you require a user with a valid Exchange mailbox and email sync configured for the environment you are working in. You may need a minimum of Exchange Administrator as a M365 role, or the Dataverse security role called "Delegated Mailbox Approver" if you are not a System Administrator, to set this up.

You should now find that if you send an email to this contact from within your model-driven app, you each email address of that distribution list will receive that same email.


Automation

That's it! You're done. Here is one such way I've used this with automation:


You might have another table which could have a lookup field to contact, called something like "Distribution List", where you might filter the lookup field control you put on the form to only filter for contacts where they are the type "Distribution List".


You can then target this lookup field through workflows, Power Automate flows and custom code for example, to send automated emails.

Further considerations

If you are using multiple environments, the contact used here counts as data, not solution components, which means a data migration of this record is required to the target environment before deploying changes, so that it has the same 36 character GUID and will not break workflows or flows.


Additionally if you wish to add into or change the email addresses in a distribution list, it must be done from the M365 admin centre, so how this is handled and whether this is the best solution may depend on how often this might happen for your client, whether you are providing that support for them, or whether they have their own user who can do this. Functionality could be built to automate this from your power app however, for example putting another "Distribution List" lookup field and a two-option field (perhaps called something like "Add to Distribution List") on the contact to trigger a Power Automate flow to add that contact's email address to the distribution list.


If the "UI/UX" of this method is not satisfactory for your client, or if you wish to provide a "prettier" solution, you might create a "Distribution List" record with a many-to-many relationship to contact, which you can add contacts into. A Power Automate flow could pick each contact pointed at through this relationship, and use their email addresses to send an email. This could also be built into a Custom Page or Canvas App if you wish to go even further with it.

Comments


bottom of page