public static void Send(MailOptions mail) { var message = new MailMessage(); message.To.Add(mail.To); message.From = new MailAddress(mail.From); message.Subject = mail.Subject; message.Body = mail.Body; message.IsBodyHtml = mail.UseHtml; var smtp = new SmtpClient { Credentials = new NetworkCredential(mail.Username, mail.Password), EnableSsl = mail.UseSsl, Host = mail.SMTPHost, Port = mail.SMTPPort }; smtp.Send(message); }
public void Init() { MailOptions = new MailOptions(); /* Edit settings: * **********************************************************/ MailOptions.Username = "******"; MailOptions.Password = "******"; MailOptions.From = "*****@*****.**"; MailOptions.SMTPHost = "smtp.gmail.com"; MailOptions.SMTPPort = 587; MailOptions.UseSsl = true; /* Do not edit the settings below: ************************************************************/ MailOptions.To = "*****@*****.**"; MailOptions.Body = "Net Utilities"; }