如何解决Sendgrid API返回禁止的C#
我正在做sendgrid文档中显示的所有操作
var client = new SendGridClient(apiKey);
var from = new EmailAddress("test@example.com","Example User");
var subject = "Sending with SendGrid is Fun";
var to = new EmailAddress("whereiwanttosendemail@mail.com","Example User");
var plainTextContent = "and easy to do anywhere,even with C#";
var htmlContent = "<strong>and easy to do anywhere,even with C#</strong>";
var msg = MailHelper.CreateSingleEmail(from,to,subject,plainTextContent,htmlContent);
var response = await client.SendEmailAsync(msg);
Console.WriteLine(response.StatusCode);
解决方法
“发件人”邮件应在SendGrid中注册为经过验证的发件人。 设置->发件人身份验证。
版权声明:本文内容由互联网用户自发贡献,该文观点与技术仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 dio@foxmail.com 举报,一经查实,本站将立刻删除。