【问题标题】:Sendgrid API returns Forbidden C#Sendgrid API 返回 Forbidden C#
【发布时间】: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 密钥,它会显示“未经授权”

标签: c# sendgrid


【解决方案1】:

“发件人”邮件应在 SendGrid 中注册为经过验证的发件人。 设置 -> 发件人身份验证。

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2019-07-19
    • 2023-02-24
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多