SendGrid电子邮件显示"已接受"但永远不会到来

时间:2017-11-28 15:26:17

标签: c# .net sendgrid sendgrid-api-v3

我是Sendgrid的新手,并制作了一个小型控制台应用程序来测试它:

static void Main(string[] args)
{
    Execute().Wait();
}

static async Task Execute()
{
    try
    {
        var apiKey = "XX.XXXXXX-R-XXXXXX_XXXXX.XXXXXXXXXXXXXXXXX_XXXXXXXXXXXXXXXXXXXXXX";
        var client = new SendGridClient(apiKey);
        var from = new EmailAddress(xxxxxxxx@xxxxxxx.com", "Me");
        var subject = "Test";
        var to = new EmailAddress("xxxxxxxx@xxxxxxx.com", "You");
        var plainTextContent = "Test";
        var htmlContent = "Test";
        var msg = MailHelper.CreateSingleEmail(from, to, subject, plainTextContent, htmlContent);
        var response = await client.SendEmailAsync(msg);
        Console.WriteLine(response.StatusCode);
        Console.WriteLine(response.Body.ReadAsStringAsync().Result);
        Console.WriteLine(response.Headers.ToString());
        Console.Read();
    }
    catch (Exception ex)
    {
        Console.WriteLine(ex.ToString());
        Console.Read();
    }
}

当我运行它时,我得到输出,表明它已被接受(没有错误,并且StatusCode被接受):

Accepted

Connection: keep-alive
X-Message-Id: N2e7faW9TuC38K25dUVFlQ
Access-Control-Allow-Origin: https://sendgrid.api-docs.io
Access-Control-Allow-Methods: POST
Access-Control-Allow-Headers: Authorization, Content-Type, On-behalf-of, x-sg-elas-acl
Access-Control-Max-Age: 600
X-No-CORS-Reason: https://sendgrid.com/docs/Classroom/Basics/API/cors.html
Date: Tue, 28 Nov 2017 15:24:32 GMT
Server: nginx

但我从未收到过该电子邮件,而SendGrid上的统计信息显示已发送0封邮件。

我已经检查过Junk,Clutter,Anti-Spam并且信息肯定没有到达。我错过了什么?

0 个答案:

没有答案