November 17, 2024

Sorting email manually is where productivity goes to die. But, even if you have a quick way to do it, nothing beats automatic, so Power Automate provides a trigger that helps you deal with emails as soon as they arrive. Today let’s explore the “When a new email arrives” trigger for Office 365.

Where to find it?

You can find it by searching “When a new email arrives.”

It’s essential to define what is an email “arriving.” It doesn’t need to be an incoming email or an email that drops in the inbox. Instead, we consider “arriving” any email that is moved to a folder when it arrives in your inbox or you move it to another folder. This is super important because it opens the doors to automation based on moving emails to folders.

There are two versions of this trigger—one for Office 365 and another for Outlook.com. Please use “Office 365,” although the other one works similarly.

Usage

There are a lot of fields that we can configure. Let’s look at them individually.

Folder

We don’t need to look at the inbox exclusively. We can have another folder where we look for new emails arriving. For example, you may have a folder where you send a pre-defined answer to the person that emails you. It’s a simple example, but you mustn’t limit yourself to incoming email emails.

To look at shared mailboxes, you need to use the “When a new email arrives in a shared mailbox” trigger.

“To”, “CC”, “To or CC”, or “From”

These fields were a great idea from Microsoft when creating this trigger. Since we receive many emails, it doesn’t make sense for the trigger to fire each time we receive an email since we’re only looking for a sub-set. With these filters, we don’t need to add huge “Condition” or “Switch” actions to filter the emails you want. Instead, the trigger does all the work for you.

Just so you know, the trigger will run only if at least one matches, which is also good if you have substantial limitations on the number of Flows you can run a day.

To use it, separate the emails with “;” You can have internal and external emails, but keep this field with only the email. When you copy emails from some email clients, you’ll have the name associated with it, so be sure to remove it.

Finally, I want to highlight the “To or CC” field. If you add an email to the “To” field or the “CC” field, the email must contain both for the Flow to trigger. But if you want either one, you can use the “To or CC” field.

Importance

The “importance” field is often ignored, but some organizations can have strict rules on using it. If yours is one of them, you can have a Flow that sends you a notification each time a “High” priority email arrives, for example. The available possibilities are:

  1. Any
  2. High
  3. Normal
  4. Low

Only with Attachments

For example, if you have a Flow that archives your attachments automatically, you may want to trigger Flows that have them. Having your Flow trigger only when a condition is satisfied makes your life easier because you don’t need to validate, for each email that arrives, if there’s an attachment or not.

Include Attachments

Should the trigger include the attachment information or not? There is, however, something that you should know. Even if you enable this feature Flow (when writing this article), it won’t fetch the attachments correctly. I go into detail in this article, but you need to know that you need to fetch the articles separately using the “Get email” action.

Subject Filter

Like the other fields, we can filter the subject for a specific string, and the Flow will only trigger if that condition is met.

Outputs

The trigger returns a lot of information in a JSON format, although the conversion from JSON is done automatically for you. Here’s an example:

{
    "headers": {
        ...
    },
    "body": {
        "id": "<redacted>",
        "receivedDateTime": "2021-09-01T10:13:32+00:00",
        "hasAttachments": false,
        "internetMessageId": "<redacted>",
        "subject": "<redacted>",
        "bodyPreview": "<redacted>",
        "importance": "normal",
        "conversationId": "<redacted>",
        "isRead": false,
        "isHtml": true,
        "body": "<body's HTML>",
        "from": "<redacted>",
        "toRecipients": "manuel@manueltgomes.com",
        "attachments": []
    }
}

Limitations

You can’t access emails in shared libraries. You need to use the “When a new email arrives in a shared mailbox” trigger.

Recommendations

Here are some things to keep in mind.

Use the filters wisely.

The filter fields are a fantastic way to trigger your Flow when the condition is met. But it’s important to know that the Flow will trigger only if all filters are met. So test your triggers and ensure they are firing when you want them. Any email that should be parsed but doesn’t fit the filters will be ignored, so it’s a hidden error since there are no error messages or warnings.

Name it correctly

The name is super important in this case since there are a lot of filters. Define in the name what you’re trying to achieve. Always build the name so that other people can understand what you are using without opening the action and checking the details.

Always add a comment.

Adding a comment will also help to avoid mistakes. For example, indicate what emails you want to fetch and the ones to ignore, the exceptions, and the reasoning behind that. It’s essential to enable faster debugging when something goes wrong. Besides, it’s good to understand the mindset and requirements when building the Flow in case someone else is debugging or improving it.

Back to the Power Automate Trigger Reference.

Photo by Signature Pro on Unsplash

Manuel Gomes

I have 18 years of experience in automation, project management, and development. In addition to that, I have been writing for this website for over 3 years now, providing readers with valuable insights and information. I hope my expertise allows me to create compelling, informative content that resonates with the audience.

View all posts by Manuel Gomes →

4 thoughts on “Power Automate: Office 365 Outlook – When a new email arrives Trigger

  1. Use this all the time. I find using inbox rules in outlook to process the emails to a folder/sub folder and then the flow just has to monitor that folder. Gives you more flexibility in those rules.

  2. Hi folks, has anyone tried using this for a high usage email scenario? are there performance limits we ought to be aware of? I’m looking at upping the polling frequency to every minute, and there is a chance the system might be bombarded with 100s of emails per minute. is there any data on the number of emails per minute we can expect this to handle?

    thanks

    Andy

Leave a Reply

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

Mastodon