The good news is that – like Send Email using .NET MailMessage – it's business as usual.
The recipe is:
Setup your IIS application's config file:
<system.net>
<mailSettings>
<smtp from="skysigal@xact-solutions.com">
<!-- use 25/587, or 465 or SSL -->
<network host="smtp.mandrillapp.com"
port="587"
userName="foo"
password="bar" />
</smtp>
</mailSettings>
</system.net>
Install-Package Mandrill
Create a .NET MailMessage object, and provision it with your message as you normally would.
THere are two ways of sending it off. SMTP or HTML.
SendGrid recommends that you stick with the SMTP one unless your ISP is limiting your outgoing port 25 and other SMTP ports – in which case its better to use the HTTP ports which they won't be restricting.
Sending using SMTP is more or less the same as it has always been, except that you give the information you would find on your SendGrid account details (https://sendgrid.com/user/account)
string userName = ConfigurationManager.AppSettings["SendGridUserId"].ToString();
string password = ConfigurationManager.AppSettings["SendGridPassword"].ToString();
MailMessage mailMsg = new MailMessage();
mailMsg.To.Add(new MailAddress("skysigal@xact-solutions.com", "Sky Sigal"));
mailMsg.From = new MailAddress("skysigal@xact-solutions.com", "Test");
mailMsg.Subject = "subject";
mailMsg.AlternateViews.Add(AlternateView.CreateAlternateViewFromString("text body", null, MediaTypeNames.Text.Plain));
mailMsg.AlternateViews.Add(AlternateView.CreateAlternateViewFromString(@"<p>html body</p>", null, MediaTypeNames.Text.Html));
// Init SmtpClient and send
SmtpClient smtpClient = new SmtpClient("smtp.mandrill.com", 25);
smtpClient.Credentials = new System.Net.NetworkCredential(userName,password);
smtpClient.Send(mailMsg);