Skip to content

Instantly share code, notes, and snippets.

What would you like to do?
Send some email using C#
/* using System.Net.Mail; */
MailMessage newMail = new MailMessage();
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 = "";
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment