public void sendEmail(AppEmailData emailDataObj) { try { AppDao appDaoObj = new AppDao(); AppEmailConfiguration emailConfigObj = appDaoObj.getEmailConfiguration(); SmtpClient SmtpServer = new SmtpClient(emailConfigObj.smtpHost); var mail = new System.Net.Mail.MailMessage(); mail.From = new MailAddress(emailConfigObj.fromAddress); mail.To.Add(emailDataObj.toAddress); if (emailDataObj.ccAddress != null && !emailDataObj.ccAddress.Equals("")) { mail.CC.Add(emailDataObj.ccAddress); } mail.Subject = emailDataObj.subject; mail.IsBodyHtml = true; string htmlBody; htmlBody = emailDataObj.bodyHtml; mail.Body = htmlBody; SmtpServer.UseDefaultCredentials = false; SmtpServer.Credentials = new System.Net.NetworkCredential(emailConfigObj.fromAddress, emailConfigObj.fromPassword); SmtpServer.EnableSsl = true; SmtpServer.Send(mail); } catch (Exception ex) { LogUtils.myLog.Info("Email while sending error : ", ex); } }