Created
December 28, 2011 18:45
-
-
Save robertgreiner/1529127 to your computer and use it in GitHub Desktop.
Send some email using C#
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
/* using System.Net.Mail; */ | |
MailMessage newMail = new MailMessage(); | |
newMail.To.Add(toAddress); | |
newMail.Subject = subject; | |
newMail.Body = body; | |
newMail.From = new MailAddress(fromAddress, name); | |
newMail.IsBodyHtml = true; | |
SmtpClient SmtpSender = new SmtpClient(); | |
SmtpSender.Port = 25; //or, whatever port your SMTP server operates on | |
SmtpSender.Host = "mail.yourdomain.com"; | |
SmtpSender.Send(newMail); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment