【问题标题】:Azure Functions SendGrid out binding does not show in SendGrid as a messageAzure Functions SendGrid 输出绑定未在 SendGrid 中显示为消息
【发布时间】:2018-10-28 12:00:06
【问题描述】:

我正在尝试使用 Azure Functions 通过 SendGrid 发送电子邮件。我有一个具有存储队列触发器和 SendGrid 输出参数的函数。在队列中添加消息后,该函数运行但没有其他任何反应。当我登录到 Sendgrid 时,它显示我的请求和传递的消息为零。我也没有收到任何电子邮件。

这可能是什么原因造成的?有什么办法可以进一步调试吗?

这是我在 C# 中的函数代码:

public static class SendChatEmail {
    [FunctionName ("SendChatEmail")]
    public static void Run ([QueueTrigger ("decision-tree-emails", Connection = "AzureWebJobsStorage")] ChatData myQueueItem, [SendGrid (ApiKey = "SendGridApiKey")] out SendGridMessage message,
        TraceWriter log) {
        log.Info ($"C# Queue trigger function processed: {myQueueItem}");

        message = new SendGridMessage ();
        message.AddTo ("matti.petrelius@gmail.com");
        message.AddContent ("text/html", "Hello there!");
        message.SetFrom (new EmailAddress ("matti.petrelius@gmail.com"));
        message.SetSubject ("Chat conversation");
    }
}

我正在使用:

Azure Functions Core Tools (220.0.0-beta.0)
Function Runtime Version: 2.0.11651.0
Microsoft Visual Studio Enterprise 2017 Version 15.7.1
Azure Functions and Web Jobs Tools - 15.0.40502.0

我也尝试在 Node.js 中创建一个类似的函数,但没有让它更好地工作。也许我使用 SendGrid 有点错误?

【问题讨论】:

    标签: azure azure-functions sendgrid


    【解决方案1】:

    好吧,没关系!事实证明,SendGrid 中的仪表板更新速度非常慢,并且在几个小时后没有显示请求。所以请求被发送和交付,仪表板只是没有显示它。此外,我没有注意到收到电子邮件,因为它们直接被定向到垃圾邮件!所以这是一场虚惊。 SendGrid 绑定工作正常,就像我做的那样。

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 2021-09-02
      • 1970-01-01
      • 2017-04-06
      • 1970-01-01
      • 2018-04-20
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多