Skip to content

Instantly share code, notes, and snippets.

@robertgreiner
Created January 21, 2010 22:02
Show Gist options
  • Save robertgreiner/283247 to your computer and use it in GitHub Desktop.
Save robertgreiner/283247 to your computer and use it in GitHub Desktop.
/* using System.Net.Mail; */
function sendEmail(string name, string subject, string body) {
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