# IT:AD:Mandrill:HowTo:Send Email using .NET MailMessage #
* [[../|(UP)]]
{{indexmenu>.#2|nsort tsort}}
The good news is that -- like [[IT/AD/SendGrid/HowTo/Send Email using .NET MailMessage]] -- it's business as usual.
## Process ##
The recipe is:
#### Config File
Setup your IIS application's config file:
#### Nuget the C# Client
Install-Package Mandrill
###### MailMessage
Create a .NET MailMessage object, and provision it with your message as you normally would.
#### Send it off
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
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(@"html body
", 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);