Created
January 16, 2013 13:20
-
-
Save Godoy/4547092 to your computer and use it in GitHub Desktop.
Send email to an SMTP endpoint using STARTTLS. (from AWS Developer Guide)
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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