Created
September 29, 2015 18:07
-
-
Save thinkingserious/14208711bd6ee49c8eb5 to your computer and use it in GitHub Desktop.
SendGrid CSharp Test
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var myMessage = new SendGridMessage(); | |
myMessage.From = new MailAddress("[email protected]"); | |
myMessage.AddTo("[email protected]"); | |
myMessage.Subject = "Testing the SendGrid Library"; | |
myMessage.Text = "Hello World"; | |
var sg_username = Environment.GetEnvironmentVariable("SENDGRID_USERNAME"); | |
var sg_password = Environment.GetEnvironmentVariable("SENDGRID_PASSWORD"); | |
var credentials = new NetworkCredential(sg_username, sg_password); | |
var transportWeb = new Web(credentials); | |
transportWeb.DeliverAsync(myMessage); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
In my tests problems lay with
await transportWeb.DeliverAsync(myMessage);
or
transportWeb.DeliverAsync(myMessage).Wait();
in that the Task never returned (even though the message was sent to the SendGrid api) which made me wonder if the thread was being lost within the DeliverAsync function?