I am in the "verify integration" stage of setting up SendGrid and am using the code below to send my first email. I have copied the code from their instructions:
// using SendGrid's C# Library
// https://github.com/sendgrid/sendgrid-csharp
using SendGrid;
using SendGrid.Helpers.Mail;
using System;
using System.Threading.Tasks;
using System.Threading;
namespace Example
{
internal class Example
{
private static async Task Main()
{
await Execute();
Thread.Sleep(10000);
}
static async Task Execute()
{
var apiKey = "myapikey";
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("test@example.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);
}
}
}
I am running this in a console app targeting netcoreapp2.0, from a mac. The code runs with no errors; its says "Accepted", but I never receive an email through SendGrid web console. What am I doing wrong?
Edit: P.S. I'm running this from my local machine, not a web server.