【问题标题】:how to send an email from a microsoft bot?如何从 microsoft bot 发送电子邮件?
【发布时间】:2019-12-16 07:59:37
【问题描述】:

我开发了一个聊天机器人并将其部署在 Skype 上。我有一件新东西要添加到机器人中。

如果用户在 bot 中请求办公室出租车,则 bot 必须接受用户输入(如目的地、员工姓名等)并将电子邮件发送到特定的邮件 ID(outlook)。

所以我的问题是:

  • 如何触发来自 Bot 的电子邮件?

【问题讨论】:

    标签: botframework azure-language-understanding qnamaker


    【解决方案1】:

    您可以使用 SendGrid。 这里有示例代码。

            System.Net.Mail.MailMessage mail = new System.Net.Mail.MailMessage();
                 SmtpClient SmtpServer = new SmtpClient("smtp.sendgrid.net");
    
                 mail.From = new MailAddress("youremailaddress@gmail.com");
                 mail.To.Add(useremail);
                 mail.Subject = "";
                 mail.Body ="";
    
                 SmtpServer.Port = 587;
                 SmtpServer.Credentials = new System.Net.NetworkCredential("apikey", "");
                 SmtpServer.EnableSsl = true;
    
                 SmtpServer.Send(mail);
    

    参考:How to make my bot send an e-mail to a given email address?

    【讨论】:

    • 补充一点,SendGrid 是第三方服务,但它确实在 Azure 资源目录中有一个列表。从那里开始,它应该会引导您完成其余的工作。
    【解决方案2】:

    尝试使用 Bot Framework 中的电子邮件技能:

    https://microsoft.github.io/botframework-solutions/skills/samples/email/

    【讨论】:

      猜你喜欢
      • 2021-07-04
      • 1970-01-01
      • 1970-01-01
      • 2017-01-16
      • 2021-05-29
      • 2014-07-19
      • 2016-12-28
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多