Smtp Send
using System; using System.Net.Mail; public static class WebUtils { public static void SmtpSend(string[] recipients, string from, string subject, string message, string smtpServer, int smtpPort, string smtpUsername, string smtpPassword) { try { foreach (string recipient in recipients) { MailMessage mailMsg = new MailMessage(); mailMsg.To.Add(recipient); MailAddress mailAddress = new MailAddress(from); mailMsg.From = mailAddress; mailMsg.Subject = subject; mailMsg.Body = message; SmtpClient smtpClient = new SmtpClient(smtpServer, smtpPort); if (!string.IsNullOrEmpty(smtpUsername)) { System.Net.NetworkCredential credentials = new System.Net.NetworkCredential(smtpUsername, smtpPassword); smtpClient.Credentials = credentials; smtpClient.EnableSsl = true; } smtpClient.Send(mailMsg); } } catch (Exception ex) { Console.WriteLine(ex.Message); } } }