public Boolean SendMail() { try { objMail.To.Add(this.toAddress); objMail.From = this.fromAddress; objMail.Subject = this.subject; objMail.Body = this.messageBody; objMail.IsBodyHtml = this.isHTMLBody; objMail.Priority = this.priority; if (!ccAddress.Equals(String.Empty)) { objMail.CC.Add(this.ccAddress); } if (!bccAddress.Equals(String.Empty)) { objMail.Bcc.Add(this.bccAddress); } SmtpClient smtpMailClient = new SmtpClient(this.mailHost); smtpMailClient.Send(objMail); return(true); } catch (Exception ex) { return(false); } }
public bool ValidarEmail(string email) { try { MailAddress emailValido = new MailAddress(email); return(emailValido.Equals(email)); } catch (Exception) { return(false); } }
///<summary>Sends an email from Info@ (or Alerts if sent to Info) synchronously.</summary> public void Send(MailAddress to, string subject, string body, bool html) { Send(InfoAddress.Equals(to) ? AlertsAddress : InfoAddress, to, subject, body, html); }