public void SendMail(EmailDto model, bool isBodyHtml = true) { SmtpClient smtpClient = new SmtpClient(); MailMessage mailMessage = new MailMessage(); CheckAnyRecipientExists(model); if (model.To != null && model.To.Count > 0) { foreach (var to in model.To) { mailMessage.To.Add(new MailAddress(to)); } } if (model.Cc != null && model.Cc.Count > 0) { foreach (var cc in model.Cc) { mailMessage.CC.Add(new MailAddress(cc)); } } if (model.Bcc != null && model.Bcc.Count > 0) { foreach (var bcc in model.Bcc) { mailMessage.Bcc.Add(new MailAddress(bcc)); } } mailMessage.Subject = model.Subject; mailMessage.Body = model.Body; mailMessage.IsBodyHtml = isBodyHtml; smtpClient.Send(mailMessage); }