基于电子邮件属性触发流Trigger a flow based on email properties

使用“收到新电子邮件时”触发器来创建一个流,该流在以下一个或多个电子邮件属性与你提供的条件匹配时运行:Use the When a new email arrives trigger to create a flow that runs when one or more of the following email properties match criteria that you provide:

属性Property 何时使用When to use
FolderFolder 每当特定文件夹收到电子邮件时触发流。Trigger a flow whenever emails arrive in a specific folder. 如果有将电子邮件路由到不同文件夹的规则,则此属性会非常有用。This property can be useful if you have rules that route emails to different folders.
ToTo 基于收件人电子邮件地址触发流。Trigger a flow based on the address to which an email was sent. 如果在同一收件箱中收到发送到其他电子邮件地址的电子邮件,则此属性会非常有用。This property can be useful if you receive email that was sent to different email addresses in the same inbox.
FromFrom 基于发件人电子邮件地址触发流。Trigger a flow based on the sender's email address.
ImportanceImportance 基于所发送电子邮件的重要性触发流。Trigger a flow based on the importance with which emails were sent. 可以按高重要性、普通重要性或低重要性来发送电子邮件。Email can be sent with high, normal, or low importance.
Has AttachmentHas Attachment 基于传入电子邮件是否存在附件触发流。Trigger a flow based on the presence of attachments in incoming emails.
Subject FilterSubject Filter 搜索电子邮件主题中是否存在特定字词。Search for the presence of specific words in the subject of an email. 然后流会基于搜索结果运行“操作”。Your flow then runs actions that are based on the results of your search.

重要

每个 Microsoft Flow 计划都包括一个运行配额。Each Microsoft Flow plan includes a run quota. 请尽量检查流触发器中的属性。Always check properties in the flow's trigger when possible. 这样做可以避免不必要地使用运行配额。Doing so avoids using your run quota unnecessarily. 如果检查某个条件中的属性,那么每次运行都将记入计划的运行配额,即使未满足定义的筛选器条件。If you check a property in a condition, each run counts against your plan's run quota, even if the filter condition that you defined isn't met.

例如,如果检查某个条件中电子邮件的“发件人”地址,每次运行都将计入计划的运行配额,即使它不是你感兴趣的“发件人”地址。For example, if you check an email's from address in a condition, each run counts against your plan's run quota, even if it's not from the address that interests you.

在下面的演练中,我们可以检查“收到新电子邮件时”触发器中的所有属性。In the following walkthroughs, we check all properties in the When a new email arrives trigger. 有关详细信息,请访问常见计费问题定价页。Learn more by visiting the frequently asked billing questions and the pricing page.

先决条件Prerequisites

  • 帐户有权访问 Microsoft FlowAn account with access to Microsoft Flow
  • Office 365 Outlook 帐户An Office 365 Outlook account
  • 适用于 AndroidiOSWindows Phone 的 Microsoft Flow 移动应用The Microsoft Flow mobile app for Android, iOS, or Windows Phone
  • 与 Office、Outlook 和推送通知服务的连接。Connections to Office, Outlook, and the push notification service

基于电子邮件主题触发流Trigger a flow based on an email's subject

在本演练中,我们创建了一个流,如果任何新电子邮件的主题中包含“彩票”一词,它就会向移动电话发送推送通知。In this walkthrough, we create a flow that sends a push notification to your mobile phone if the subject of any new email has the word "lottery" in it. 该流随后会将任何此类电子邮件标记为已读。Your flow then marks any such email as read.

备注

在本演练发送推送通知期间,仍可使用适合工作流需要的任何其他操作。While this walkthrough sends a push notification, you're free to use any other action that suits your workflow needs. 例如,可以在 Google 表格或存储在 Dropbox 上的 Microsoft Excel 文件等其他存储库中存储电子邮件内容。For example, you could store the email contents in another repository such as Google Sheets or a Microsoft Excel file stored on Dropbox.

好了,开始操作:Ok, let's get started:

  1. 登录到 Microsoft Flow,然后选择“我的流”选项卡。Sign in to Microsoft Flow, and then select the My flows tab.

  2. 选择“从零开始创建”。Select Create from blank.

    空流

  3. 搜索“电子邮件”,然后从触发器列表中选择“Office 365 Outlook - 收到新电子邮件时”。Search for "email", and then select Office 365 Outlook - When a new email arrives from the list of triggers. 每当收到电子邮件时,此触发器都会运行。This trigger runs each time an email arrives.

    电子邮件触发器

  4. 选择想要流来监视传入电子邮件的文件夹,然后选择“显示高级选项”。Select the folder that you'd like the flow to monitor for incoming emails, and then select Show advanced options.

    备注

    若要显示所有电子邮件文件夹,请选择“显示选取器”图标,该图标位于“收到新电子邮件时”卡的“文件夹”框的右侧。To display all your email folders, select the Show Picker icon, which is located on the right side of the Folder box on the When a new email arrives card.

    文件夹属性

  1. 在“主题筛选器”框中,输入流用于筛选传入电子邮件的文本。In the Subject Filter box, enter the text that your flow uses to filter incoming emails.

    在此示例中,我们对主题中包含“彩票”一词的任何电子邮件都感兴趣。In this example, we're interested in any email that has the word "lottery" in the subject.

    高级选项

    1. 选择“新建步骤” > “添加操作”。Select New step > Add an action.

    2. 搜索“通知”,然后从操作列表中选择“通知 - 向我发送移动通知”。Search for "notification," and then select Notifications - Send me a mobile notification from the list of actions.

      通知

  2. 输入收到与先前指定的“主题筛选器”匹配的电子邮件时要接收的移动通知的详细信息。Enter the details for the mobile notification you want to receive when you receive an email that matches the Subject Filter you specified earlier.

    通知详细信息

    1. 选择“新建步骤” > “添加操作”。Select New step > Add an action.

    2. 搜索“已读”,然后从操作列表中选择“Office 365 Outlook - 标记为已读”。Search for "read", and then select Office 365 Outlook - Mark as read from the list of actions.

      标记为已读

    3. 在“标记为已读”卡片中,在“消息 ID 框中”添加“MessageId”标记。In the Mark as read card, add the MessageId token in the Message Id box.

      如果“消息 ID”令牌不可见,则通过在搜索框中输入“消息 ID”进行搜索。If the Message Id token isn't visible, search for it by entering Message Id in the search box.

      消息 ID

  3. 为流命名。Give your flow a name. 然后选择页面顶部的“创建流”进行保存。Then save it by selecting Create flow at the top of the page.

    保存流

恭喜!Congratulations! 现在,每次收到主题中包含“彩票”一词的电子邮件时,你都将收到推送通知。You now receive a push notification each time you receive an email that contains the word "lottery" in the subject.

基于电子邮件的发件人触发流Trigger a flow based on an email's sender

在本演练中,我们创建了一个流,如果收到任何来自特定发件人(电子邮件地址)的新邮件,它就会向移动电话发送推送通知。In this walkthrough, we create a flow that sends a push notification to your mobile phone if any new email arrives from a specific sender (email address). 此流随后会将任何此类电子邮件标记为已读。The flow also marks any such email as read.

  1. 登录到 Microsoft Flow,然后选择“我的流”选项卡。Sign in to Microsoft Flow, and then select the My flows tab.

  2. 选择“从零开始创建”。Select Create from blank.

    空流

  3. 搜索“电子邮件”,然后从触发器列表中选择“Office 365 Outlook - 收到新电子邮件时”。Search for "email", and then select Office 365 Outlook - When a new email arrives from the list of triggers. 每当收到电子邮件时,此触发器都会运行。This trigger runs each time an email arrives.

    电子邮件触发器

  4. 选择想要流来监视传入电子邮件的文件夹,然后选择“显示高级选项”。Select the folder that you'd like the flow to monitor for incoming emails, and then select Show advanced options.

    备注

    若要显示所有电子邮件文件夹,请选择“显示选取器”图标,该图标位于“收到新电子邮件时”卡的“文件夹”框的右侧。To display all your email folders, select the Show Picker icon, which is located on the right side of the Folder box on the When a new email arrives card.

    文件夹属性

  1. 在“发件人”框中,输入发件人的电子邮件地址。In the From box, enter the email address of the sender.

    流会对任何发送自该地址的电子邮件执行操作。Your flow takes action on any emails that are sent from this address.

    电子邮件属性

    1. 选择“新建步骤” > “添加操作”。Select New step > Add an action.

    2. 搜索“通知”,然后从操作列表中选择“通知 - 向我发送移动通知”。Search for "notification," and then select Notifications - Send me a mobile notification from the list of actions.

      通知

  2. 输入收到先前输入的电子邮件地址发来的邮件时要收到的移动通知的详细信息。Enter the details for the mobile notification you'd like to receive whenever a message arrives from the email address that you entered earlier.

    通知详细信息

    1. 选择“新建步骤” > “添加操作”。Select New step > Add an action.

    2. 搜索“已读”,然后从操作列表中选择“Office 365 Outlook - 标记为已读”。Search for "read", and then select Office 365 Outlook - Mark as read from the list of actions.

      标记为已读

    3. 在“标记为已读”卡片中,在“消息 ID 框中”添加“MessageId”标记。In the Mark as read card, add the MessageId token in the Message Id box.

      如果“消息 ID”令牌不可见,则通过在搜索框中输入“消息 ID”进行搜索。If the Message Id token isn't visible, search for it by entering Message Id in the search box.

      消息 ID

  3. 通过选择页面顶部的“创建流”为流命名,然后进行保存。Give your flow a name, and then save it by selecting Create flow at the top of the page.

    保存流

当特定文件夹收到电子邮件时触发流。Trigger a flow when emails arrive in a specific folder

如果有根据地址等某些属性将电子邮件路由到不同文件夹的规则,则可能会想要使用此类型的流。If you have rules that route email to different folders based on certain properties, such as the address, you may want this type of flow.

开始操作:Let's get started:

备注

如果还没有将电子邮件路由到收件箱以外的文件夹的规则,请创建此类规则,并通过发送测试电子邮件确认它可以正常工作。If you don't already have a rule that routes email to a folder other than your inbox, create such a rule and confirm it works by sending a test email.

  1. 登录到 Microsoft Flow,然后选择“我的流”选项卡。Sign in to Microsoft Flow, and then select the My flows tab.

  2. 选择“从零开始创建”。Select Create from blank.

    空流

  3. 搜索“电子邮件”,然后从触发器列表中选择“Office 365 Outlook - 收到新电子邮件时”。Search for "email", and then select Office 365 Outlook - When a new email arrives from the list of triggers. 每当收到电子邮件时,此触发器都会运行。This trigger runs each time an email arrives.

    搜索电子邮件

  1. 选择要向其路由特定电子邮件的文件夹。Select the folder to which you're routing specific emails. 若要显示所有电子邮件文件夹,请先选择“显示选取器”图标,该图标位于“收到新电子邮件时”卡的“文件夹”框的右侧。To display all email folders, first select the Show Picker icon, which is located on the right side of the Folder box on the When a new email arrives card.

    选择文件夹

    1. 选择“新建步骤” > “添加操作”。Select New step > Add an action.

    2. 搜索“通知”,然后从操作列表中选择“通知 - 向我发送移动通知”。Search for "notification," and then select Notifications - Send me a mobile notification from the list of actions.

      通知

  2. 输入先前选择的文件夹中收到电子邮件时要接收的移动通知的详细信息。Enter the details for the mobile notification you'd like to receive when an email arrives in the folder you selected earlier. 如果尚未执行此操作,请输入通知服务的凭据。If you haven't already, enter the credentials for the notifications service.

    通知详细信息

    1. 选择“新建步骤” > “添加操作”。Select New step > Add an action.

    2. 搜索“已读”,然后从操作列表中选择“Office 365 Outlook - 标记为已读”。Search for "read", and then select Office 365 Outlook - Mark as read from the list of actions.

      标记为已读

    3. 在“标记为已读”卡片中,在“消息 ID 框中”添加“MessageId”标记。In the Mark as read card, add the MessageId token in the Message Id box.

      如果“消息 ID”令牌不可见,则通过在搜索框中输入“消息 ID”进行搜索。If the Message Id token isn't visible, search for it by entering Message Id in the search box.

      消息 ID

  3. 通过选择页面顶部的“创建流”为流命名,然后进行保存。Give your flow a name, and then save it by selecting Create flow at the top of the page.

    保存流

通过发送路由到本演练中先前选中文件夹的电子邮件来测试此流。Test the flow by sending an email that gets routed to the folder you selected earlier in this walkthrough.