azure - Azure Functions SendGrid 输出绑定未在 SendGrid 中显示为消息
问题描述
我正在尝试使用 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 不知何故错了?
解决方案
好吧,不管这个!事实证明,SendGrid 中的仪表板更新速度非常慢,并且在几个小时后没有显示请求。所以请求被发送和交付,仪表板只是没有显示它。此外,我没有注意到收到电子邮件,因为它们直接被定向到垃圾邮件!所以这是一场虚惊。SendGrid 绑定按照我的方式工作得很好。
推荐阅读
- sql - 基于插入的 T-SQL 触发器更新列
- html - 使 Bootstrap 卡的高度相同
- node.js - RegEx 检查时出现语法错误
- sql-server - 从序列中获取连续片段
- react-native - 在 React-Native 中控制通知的声音和振动
- nosql - pouchdb-find + $in : 没有找到匹配的索引
- angular-material - Angular 材质选项卡 - 添加自定义 html
- php - MYSQL order by left join 现有行
- powershell - 添加-PSSnapin Windows 10
- javascript - 当值有换行符时在数组中搜索字符串