Tags : asp-netasp-net-mvcemailmail
This is a simple snippet function which take an email address, subject string and email body string.
public static void SendMail(string toAddress, string subject, string body)
{
MailMessage mail = new MailMessage( );
mail.From = new MailAddress(SnippetApp.GlobalSettings.SupportEmailAddress);
mail.To.Add(new MailAddress(toAddress));
mail.Subject = subject;
// Set the body of the mail message
mail.Body = body;
mail.IsBodyHtml = true;
mail.Priority = MailPriority.Normal;
SmtpClient mSmtpClient = new SmtpClient("localhost");
mSmtpClient.Send(mail);
}
blog comments powered by Disqus