1. create a send grid account
![](http://img.blog.csdn.net/20160317143704503?watermark/2/text/aHR0cDovL2Jsb2cuY3Nkbi5uZXQv/font/5a6L5L2T/fontsize/400/fill/I0JBQkFCMA==/dissolve/70/gravity/Center)
![](http://img.blog.csdn.net/20160317143720685?watermark/2/text/aHR0cDovL2Jsb2cuY3Nkbi5uZXQv/font/5a6L5L2T/fontsize/400/fill/I0JBQkFCMA==/dissolve/70/gravity/Center)
2. remember the username/password of the send grid account
![](http://img.blog.csdn.net/20160317143749092?</p><p>watermark/2/text/aHR0cDovL2Jsb2cuY3Nkbi5uZXQv/font/5a6L5L2T/fontsize/400/fill/I0JBQkFCMA==/dissolve/70/gravity/Center)
3. install sendgrid nuget pkg
![](http://img.blog.csdn.net/20160317143811972?watermark/2/text/aHR0cDovL2Jsb2cuY3Nkbi5uZXQv/font/5a6L5L2T/fontsize/400/fill/I0JBQkFCMA==/dissolve/70/gravity/Center)
4. get key
manage ->it will redirect you to manage portal
![](http://img.blog.csdn.net/20160317143827612?watermark/2/text/aHR0cDovL2Jsb2cuY3Nkbi5uZXQv/font/5a6L5L2T/fontsize/400/fill/I0JBQkFCMA==/dissolve/70/gravity/Center)
create a new api key:
![](http://img.blog.csdn.net/20160317143840191?</p><p>watermark/2/text/aHR0cDovL2Jsb2cuY3Nkbi5uZXQv/font/5a6L5L2T/fontsize/400/fill/I0JBQkFCMA==/dissolve/70/gravity/Center)
4. sample code of console application
2. remember the username/password of the send grid account
3. install sendgrid nuget pkg
4. get key
manage ->it will redirect you to manage portal
create a new api key:
4. sample code of console application
using System; using System.Net.Mail; using SendGrid; namespace SendGridAzureSample { class Program { static void Main(string[] args) { SendGridMessage myMessage = new SendGridMessage(); myMessage.AddTo("send_to"); myMessage.From = new MailAddress("from_email", "Display name"); myMessage.Subject = "Testing the SendGrid Library"; myMessage.Text = "Hello World!"; //myMessage.AddAttachment(@"attachment_path"); var key = "your_key"; // create a Web transport, using API Key var transportWeb = new Web(key); transportWeb.DeliverAsync(myMessage); Console.ReadKey(); } } }
reference link : https://azure.microsoft.com/en-us/documentation/articles/sendgrid-dotnet-how-to-send-email/