public void SendCustomerMailSMTP(int CustomerId, string CustomerName) { SR_Log_DatabaseSQLEntities db = new SR_Log_DatabaseSQLEntities(); SettingsRepository setting = new SettingsRepository(); string rcptCustInfoTo = ""; string sbody = ""; List <Customer_Info_Mail> lstcustmailto = setting.GetCustomerInfoMail(); foreach (var i in lstcustmailto) { rcptCustInfoTo += i.CustomerInfoMail + ";"; } sbody = "<html><head><meta http-equiv=Content-Type content='text/html; charset=us-ascii'><meta name=Generator content='Microsoft Word 12 (filtered medium)'></head>"; sbody = sbody + "<P style='color:#1F497D';><body lang=EN-US link=blue vlink=purple><div class=Section1><p class=MsoNormal><span style='font-size:12pt;font-family:'tahoma, verdana, 'sans-serif'''><span style='color:#1F497D'>"; sbody = sbody + "<b> The Following Customer is added in database by user : "******"User"]) + "</b><br><br>"; List <tblCustAddress> custAddressDetails = db.tblCustAddresses.Where(x => x.CustomerId == CustomerId).ToList(); sbody = sbody + "<table style='font-size:12pt;font-family:'tahoma, verdana, 'sans-serif'''>"; sbody = sbody + "<tr><td><b>CustomerName<b></td><td>: </td><td>" + CustomerName + "</td></tr>"; if (custAddressDetails != null) { if (custAddressDetails.Count > 0) { for (int i = 0; i < custAddressDetails.Count(); i++) { sbody = sbody + "<tr><td><b>Jobsite Address<b></td><td>: </td><td>" + custAddressDetails[i].Address1 + "</td></tr>"; } } } sbody = sbody + "</table>"; sbody = sbody + "<br />"; sbody = sbody + "<b>This E-mail is automatically sent by SR Log Database.<b></body></html>"; MailSend m = new MailSend(); m.sendMail(rcptCustInfoTo, "SR Log - New Customer Created", sbody, "", true); }