1. create a send grid account

使用azure send grid发送email_.net

使用azure send grid发送email_microsoft_02

2. remember the username/password of the send grid account


使用azure send grid发送email_microsoft_03


3. install sendgrid nuget pkg

使用azure send grid发送email_.net_04
4. get key


manage ->it will redirect you to manage portal
使用azure send grid发送email_.net_05


create a new api key:
使用azure send grid发送email_microsoft_06
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();
        }
    }
}