【发布时间】:2020-09-02 10:26:24
【问题描述】:
我正在按照 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);
【问题讨论】:
-
把 C# 排除在外 - 你可以使用 Postman 通过 SendGrid 发送电子邮件吗? 我敢打赌,你的 apikey 是错误的。
-
如果我输入了错误的 api 密钥,它会显示“未经授权”