问题描述
我正在做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中注册为经过验证的发件人。 设置->发件人身份验证。