Skip to content

Let's POWER Automate

From no-code to low-code

Menu
  • Expressions
  • Filters
  • General
  • Problems
  • Triggers
  • Application specific solutions
    • Excel
    • Forms
    • Planner
    • Outlook
    • SharePoint
    • Teams
  • Resources
Menu

Split email recipients into batches of 500 with Power Automate flow

Posted on February 27, 2022February 27, 2022 by Tom

“I need to send an email to thousands of users but Exchange allows me to use only 500 recipients for an email, how can I split them into batches of 500 with Power Automate?”


If you’re sending emails to individual recipients, you might encounter the Exchange limit. There’s a maximum number of recipients for each email that’s set to 500 by default. If you want to send the same email to more recipients, you’ll have to either increase the limit (up to 1000), or split it into multiple emails. This post describes the second option – how to split the recipients into smaller batches of 500.

Create an array with the emails

The first step is to convert the email addresses into an array. If it’s a list of semicolon separated emails, split(…) it by the semicolon character, e.g.

split(<list of emails>, ';')

If it’s an array of objects, e.g. SharePoint items, then ‘Select’ only the email addresses.

Take a piece of an array

For the actual split into batches you’ll need the skip(…) and take(…) expressions.

Take(…) expression

The take(…) expression will take the specified amount of items from an array. The array is the first parameter, number of items to take is the second one. For example, to take 500 items (emails) from an array:

take(<array with emails>, 500)

Note: <…> is a placeholder, replace it including the < and >.

But this will always take the first 500 emails. To process all the emails you must always skip those that were already processed. That’s what the skip(…) expression will do.

Skip(…) expression

The skip(…) expression will skip items in an array. You enter the array as the first parameter and the number of items to skip as the second one, e.g.

skip(<array with emails>, 10)

Note: <…> is a placeholder, replace it including the < and >

The expression above will skip the first 10 emails and return the rest. But here you don’t have a fixed number of emails to skip. At first you want to skip 0 and process the first 500, then skip that 500 and take another 500, followed by skipping 1000 and taking another 500. That’s why you’ll need a number variable – let’s call it var_processed and set it to 0.

This variable will serve as a counter of the processed emails.

Process the batches of 500 emails

As already mentioned, you don’t want to take always the same 500 emails. You want to move in the array.

Power Automate split email recipients

That can be done using the same expression while changing the number of emails to skip. That means a loop with the ‘Do until’ action. Keep moving in the array until the number of processed items (var_processed) is greater or equal to the count of all emails (length(…)).

In each loop take the next 500 emails…

take(skip(body('Select'),variables('var_processed')),500)

…join them with the semicolon, and use them to send the email.

join(take(skip(body('Select'),variables('var_processed')),500),';')

Then increment the variable to skip the already processed 500 emails.

Power Automate split email recipients

Summary

If you’re sending an email via Power Automate to more than 500 recipients, you’ve got two options. You can either increase the limit (if you’ve got administrator permissions and if 1000 is enough) or you’ll have to split it into multiple emails. Using a loop, variable, and the take(…) and skip(…) expressions you can split the recipients into batches, and process them within the default limitations.


Do you struggle with the various expressions, conditions, filters, or HTTP requests available in Power Automate?

I send one email per week with a summary of the new solutions, designed to help even non IT people to automate some of their repetitive tasks.

All subscribers have also access to resources like a SharePoint Filter Query cheat sheet or Date expressions cheat sheet.

Zero spam, unsubscribe anytime.

Leave a Reply Cancel reply

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

Now available:

The Ultimate Power Automate expressions cheat sheet
Equip yourself with the tool to translate your thoughts into Power Automate expressions!

Do you struggle with the various expressions, conditions, filters, or HTTP requests available in Power Automate?

I send one email per week with a summary of the new solutions, designed to help even non IT people to automate some of their repetitive tasks.

All subscribers have also access to resources like a SharePoint Filter Query cheat sheet or Date expressions cheat sheet.

Zero spam, unsubscribe anytime.

Hello and welcome!

My name is Tom and I'm a business process automation consultant and Microsoft MVP living in the Czech Republic. I’ve been working with Microsoft technologies for almost 10 years, currently using mainly Power Automate, SharePoint, Teams, and the other M365 tools.

I believe that everyone can automate part of their work with the Power Automate platform. You can achieve a lot by "clicking" the flows in the designer, but you can achieve much more if you add a bit of coding knowledge. And that's what this blog is about.

To make the step from no-code Power Automate flows to low-code flows: using basic coding knowledge to build more complex yet more efficient flows to automate more of your daily tasks.

  • Format results of date calculation in SharePoint columnJune 29, 2022
  • Why is your Power Automate flow creating duplicatesJune 26, 2022
  • How to create a unique identifier in your Power Automate flowJune 22, 2022
  • How to assign custom SharePoint permission level with Power AutomateJune 19, 2022
  • Remove permissions from a specific SharePoint user with Power AutomateJune 15, 2022

Power Automate blogs worth visiting

Damien Bird
Dennis (Expiscornovus)
Paul Murana

© 2022 Let's POWER Automate | Powered by Superbs Personal Blog theme