基于电子邮件属性触发流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 these email properties match criteria you provide:

属性Property 何时使用When to use
FolderFolder 每当特定文件夹收到电子邮件时触发流。Trigger a flow whenever emails arrive into 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 on incoming emails.
Subject FilterSubject Filter 搜索电子邮件主题中是否存在特定字词。Search for the presence of specific words in the subject of an email. 然后流会基于搜索结果运行“操作”。Your flow then runs actions 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 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 walk-throughs below, we check all properties in the When a new email arrives trigger. 有关详细信息,请访问常见计费问题定价页。You can 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 365 Outlook 和推送通知服务的连接。Connections to Office 365 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.

注意:在本演练发送推送通知期间,用户仍然可以随意使用适合工作流需要的任何其他操作。Note: 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 into 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.

    注意:若要显示所有电子邮件文件夹,请选择“显示选取器”图标,该图标位于“收到新电子邮件时”卡的“文件夹”框的右侧。Note: 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 I'm 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.

    通知

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

    通知详细信息

  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”令牌添加到“标记为已读”卡的“消息 ID”框。Add the MessageId token into the Message Id box on the Mark as read card.

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

    消息 ID

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

    保存流

祝贺你,在每次收到主题中包含“彩票”一词的电子邮件时,你都将收到推送通知。Congratulations, you 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 into 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.

    注意:若要显示所有电子邮件文件夹,请选择“显示选取器”图标,该图标位于“收到新电子邮件时”卡的“文件夹”框的右侧。Note: 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. 将发件人的电子邮件地址输入到“发件人”中。Enter the email address of the sender into From.

    流会对任何发送自该地址的电子邮件执行操作。Your flow takes action on any emails 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.

    通知

  1. 每当收到先前输入的电子邮件地址发来的邮件时,输入想要收到的移动通知的详细信息。Enter the details for the mobile notification you'd like to receive whenever a message arrives from the email address 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”令牌添加到“标记为已读”卡的“消息 ID”框。Add the MessageId token into the Message Id box on the Mark as read card.

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

    消息 ID

  1. 通过选择页面顶部的“创建流”为流命名,然后进行保存。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 into 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've created the rule to route 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.

    通知

  1. 在先前选择的文件夹收到电子邮件时,输入想要接收的移动通知的详细信息。Enter the details for the mobile notification you'd like to receive when an email arrives into the folder you've 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”令牌添加到“标记为已读”卡的“消息 ID”框。Add the MessageId token into the Message Id box on the Mark as read card.

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

    消息 ID

  1. 通过选择页面顶部的“创建流”为流命名,然后进行保存。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.