sev*_*rin 7 c# azure sendgrid asp.net-core-1.0
我使用最新的SendGrid .NET包(8.0.3)从我的ASP.NET Core Web应用程序发送电子邮件:
public Task SendEmailAsync(string email, string subject, string message)
{
return Send(email, subject, message);
}
async Task Send(string email, string subject, string message)
{
dynamic sg = new SendGridAPIClient(_apiKey);
var from = new Email("noreply@my.domain", "My Name");
var to = new Email(email);
var content = new Content("text/html", message);
var mail = new Mail(from, subject, to, content);
await sg.client.mail.send.post(requestBody: mail.Get());
}
Run Code Online (Sandbox Code Playgroud)
它在本地工作,但在Azure App Service实例上运行时,邮件无法通过.
代码运行良好,没有任何例外,所以我几乎无法使用,但我认为它可能是某种防火墙问题.
有没有人遇到类似的问题?我该如何调试呢?
我也在我的 Azure Web 应用程序中使用 SendGrid。我可以在本地调试时以及在 Azure 中部署到生产环境后发送。以下是需要检查的几件事:
| 归档时间: |
|
| 查看次数: |
2581 次 |
| 最近记录: |