Skip to content

Instantly share code, notes, and snippets.

@matijagrcic
Created April 21, 2014 07:16
Show Gist options
  • Save matijagrcic/11134808 to your computer and use it in GitHub Desktop.
Save matijagrcic/11134808 to your computer and use it in GitHub Desktop.
Use Gmail to send email from Azure
var smtp = new SmtpClient
{
Host = "smtp.gmail.com",
Port = 587,
EnableSsl = true,
DeliveryMethod = SmtpDeliveryMethod.Network,
UseDefaultCredentials = false,
Credentials = new NetworkCredential(fromAddress.Address, "yourApplicationSpecificPassword")
};
using (var message = new MailMessage(fromAddress, toAddress)
{
IsBodyHtml = true,
Subject = subject,
Body = body
})
{
smtp.Send(message);
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment