Skip to content

Instantly share code, notes, and snippets.

@Godoy
Created January 16, 2013 13:20
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save Godoy/4547092 to your computer and use it in GitHub Desktop.
Save Godoy/4547092 to your computer and use it in GitHub Desktop.
Send email to an SMTP endpoint using STARTTLS. (from AWS Developer Guide)
public static void SendWithSMTP(string username, string password, string host, int port)
{
using (var client = new System.Net.Mail.SmtpClient(host, port))
{
client.Credentials = new System.Net.NetworkCredential(username, password);
client.EnableSsl = true;
client.Send("from@example.com", "to@example.com", "This is a test subject.", "This is a test email message body.");
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment