使用 Azure 逻辑应用从 SMTP 帐户发送电子邮件Send email from your SMTP account with Azure Logic Apps

使用 Azure 逻辑应用和简单邮件传输协议 (SMTP) 连接器,可以创建从 SMTP 帐户发送电子邮件的自动化任务和工作流。With Azure Logic Apps and the Simple Mail Transfer Protocol (SMTP) connector, you can create automated tasks and workflows that send email from your SMTP account. 还可以让其他操作使用来自 SMTP 操作的输出。You can also have other actions use the output from SMTP actions. 例如,在 SMTP 发送电子邮件后,你可以通过 Slack 连接器通知你在 Slack 中的团队。For example, after your SMTP sends an email, you can notify your team in Slack with the Slack connector. 如果你不熟悉逻辑应用,请查看什么是 Azure 逻辑应用?If you're new to logic apps, review What is Azure Logic Apps?

先决条件Prerequisites

  • Azure 订阅。An Azure subscription. 如果没有 Azure 订阅,请注册一个 Azure 试用帐户If you don't have an Azure subscription, sign up for a trial Azure account.

  • SMTP 帐户和用户凭据Your SMTP account and user credentials

    你的凭据授权逻辑应用创建连接并访问你的 SMTP 帐户。Your credentials authorize your logic app to create a connection and access your SMTP account.

  • 有关如何创建逻辑应用的基本知识Basic knowledge about how to create logic apps

  • 要在其中访问 SMTP 帐户的逻辑应用。The logic app where you want to access your SMTP account. 若要使用 SMTP 操作,请使用触发器启动逻辑应用,例如,如果你有 Salesforce 帐户,则可使用 Salesforce 触发器。To use an SMTP action, start your logic app with a trigger, such as a Salesforce trigger, if you have a Salesforce account.

    例如,可以使用“创建记录时”Salesforce 触发器来启动逻辑应用。For example, you can start your logic app with the When a record is created Salesforce trigger. 每当在 Salesforce 中创建新记录(例如潜在顾客)时,此触发器都会激发。This trigger fires each time that a new record, such as a lead, is created in Salesforce. 在此触发器后,可以跟随执行 SMTP 发送电子邮件操作。You can then follow this trigger with the SMTP Send Email action. 这样一来,当创建了新记录时,逻辑应用都会从你的 SMTP 帐户发送一封关于新记录的电子邮件。That way, when the new record is created, your logic app sends an email from your SMTP account about the new record.

连接到 SMTPConnect to SMTP

要使逻辑应用能够访问某个服务,必须在逻辑应用与该服务之间创建连接。Before your logic app can access any service, you must create a connection between your logic app and that service. 如果以前未创建此连接,则在向逻辑应用添加该服务的触发器或操作时,系统会提示输入连接信息。If you didn't previously create this connection, you're prompted for connection information when you add a trigger or action for that service to your logic app. 可以使用逻辑应用设计器轻松地直接从逻辑应用创建此连接。The Logic Apps Designer provides an easy way for you to create this connection directly from your logic app.

  1. 登录到 Azure 门户,在逻辑应用设计器中打开逻辑应用(如果尚未打开)。Sign in to the Azure portal, and open your logic app in Logic App Designer, if not open already.

  2. 在要添加 SMTP 操作的最后一个步骤下,选择“新建步骤”。Under the last step where you want to add an SMTP action, choose New step.

    若要在步骤之间添加操作,请将鼠标指针移到步骤之间的箭头上。To add an action between steps, move your pointer over the arrow between steps. 选择出现的加号 ( + ),然后选择“添加操作”。Choose the plus sign (+) that appears, and then select Add an action.

  3. 在搜索框中,输入“smtp”作为筛选器。In the search box, enter "smtp" as your filter. 在操作列表下,选择所需的操作。Under the actions list, select the action you want.

  4. 出现提示时,提供此连接信息:When prompted, provide this connection information:

    属性Property 必须Required 说明Description
    连接名称Connection Name Yes 到 SMTP 服务器的连接的名称A name for the connection to your SMTP server
    SMTP 服务器地址SMTP Server Address Yes SMTP 服务器的地址The address for your SMTP server
    用户名User Name Yes SMTP 帐户的用户名Your username for your SMTP account
    密码Password Yes SMTP 帐户的密码Your password for your SMTP account
    SMTP 服务器端口SMTP Server Port No SMTP 服务器上你要使用的特定端口A specific port on your SMTP server you want to use
    启用 SSL?Enable SSL? No 启用或禁用 TLS/SSL 加密。Turn on or turn off TLS/SSL encryption.
  5. 为所选操作提供必要的详细信息。Provide the necessary details for your selected action.

  6. 保存逻辑应用,或继续构建逻辑应用的工作流。Save your logic app or continue building your logic app's workflow.

连接器参考Connector reference

有关此连接器的更多技术详细信息,例如触发器、操作和限制(如此连接器的 Swagger 文件所述),请参阅连接器的参考页For more technical details about this connector, such as triggers, actions, and limits as described by the connector's Swagger file, see the connector's reference page.

后续步骤Next steps