botframework - 从机器人框架 FormFlow 发送电子邮件

标签 botframework

我有一个使用 FormFlow 创建的示例机器人:

public static IForm<SandwichOrder> BuildForm()
        {
            OnCompletionAsyncDelegate<SandwichOrder> processOrder = async (context, state) =>
            {
                await context.PostAsync("We are currently processing your sandwich. We will message you the status.");
            };

            return new FormBuilder<SandwichOrder>()
                        .Message("Welcome to the sandwich order bot!")
                        .Field(nameof(Sandwich))
                        .Field(nameof(Length))
                        .Field(nameof(Bread))
                        .Field(nameof(Cheese))
                        .AddRemainingFields()
                        .Message("Thanks for ordering a sandwich!")
                        .OnCompletion(processOrder)
                        .Build();
    }

完成表单后,控件位于:

OnCompletionAsyncDelegate<SandwichOrder> processOrder = async (context, state) =>
                {
                    await context.PostAsync("We are currently processing your sandwich. We will message you the status.");
                };

我想向自己发送一封包含所有表单字段的电子邮件。如何连接 SMTP 并编写电子邮件函数来发送包含所有选定选项和用户输入的电子邮件?

最佳答案

这个问题与Botframework无关,它只是“如何从C#发送电子邮件”。

您有多种选择,例如:

  • 使用 SendGrid
  • 使用SMTPClient(看看这里,例如:Send e-mail via SMTP using C#)
  • 如果您使用 Office 365 帐户(或在本地,但取决于配置等),则使用 Graph API
  • 使用 EWS(Exchange Web 服务)
  • 其他方式...

您想要放入电子邮件中的字段包含在 state 变量中

关于botframework - 从机器人框架 FormFlow 发送电子邮件,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/47900892/

相关文章:

c# - Microsoft Bot Framework System.ArgumentException : 'EncryptedText is not properly formatted'

botframework - Microsoft Bot Framework - Webchat 文本为 html

botframework - Azure 中的机器人注册与应用程序注册

c# - 微软的 botframework 是免费的吗?

node.js - 自适应卡的 JSON 有效负载在 http 请求正文中变得困惑

node.js - 如何在不同的文件中拆分 Bot Framework 对话框

c# - 在 bot 框架中的 c# bot 中查询自动完成

bots - 如果用户输入了错误的数据,您可以在瀑布对话框中返回一步吗? #botframework

node.js - Node.js 中 Facebook 聊天机器人中的分享按钮

python - Microsoft Bot Framework 与 python 运行时出现问题