public bool Send() { bool mailSent = false; try { MailMessage Mail = new MailMessage(); if (ToAddress != null) { ToAddress.ForEach(x => Mail.To.Add(x)); } if (CcAddress != null) { CcAddress.ForEach(x => Mail.CC.Add(x)); } if (BccAddress != null) { BccAddress.ForEach(x => Mail.Bcc.Add(x)); } Mail.From = new MailAddress(this.FromAddress); Mail.Subject = this.Subject; Mail.Body = this.Body; Mail.IsBodyHtml = this.IsBodyHtml; if (Attachments.Count > 0) { foreach (var attchment in Attachments) { Mail.Attachments.Add(attchment); } } SmtpClient SMTP = new SmtpClient(this.SmtpAddress); SMTP.UseDefaultCredentials = false; SMTP.Credentials = new System.Net.NetworkCredential(this.UserName, this.Password); SMTP.Port = this.Port; SMTP.Host = this.SmtpAddress; SMTP.EnableSsl = this.SslEnabled; SMTP.Send(Mail); SMTP.Dispose(); Mail.Dispose(); mailSent = true; } catch (Exception ex) { mailSent = false; } return(mailSent); }