public bool SenMailFeedback_NIC(string UserName, string Message, string FromUser) { try { ProjectConfi1 pconfig = new ProjectConfi1(); string urlDomain = System.Configuration.ConfigurationManager.AppSettings["connectionUrl"].ToString(); MailAddress _fromMailAddress = new MailAddress(pconfig.MailSenderEmail, pconfig.MailSenderDisplayName); MailAddress _bccMailAddress = new MailAddress(pconfig.MailSenderEmail, pconfig.MailSenderDisplayName); SmtpClient smtpClient = new SmtpClient(); smtpClient.Host = pconfig.MailServer; smtpClient.Port = pconfig.MailPort; smtpClient.EnableSsl = pconfig.MailIsSSL; smtpClient.UseDefaultCredentials = true; smtpClient.Credentials = new NetworkCredential(pconfig.MailSenderUsername, pconfig.MailSenderPassword); MailMessage _mailMessage = new MailMessage(); _mailMessage.IsBodyHtml = true; _mailMessage.From = _fromMailAddress; _mailMessage.Bcc.Add(_fromMailAddress); _mailMessage.To.Add("*****@*****.**"); _mailMessage.Subject = "Feedback mail from " + UserName; string HtmlBody = "Email From : " + FromUser + "<br>" + Message; _mailMessage.Body = (HtmlBody); //smtpClient.EnableSsl = true; _mailMessage.IsBodyHtml = true; smtpClient.Send(_mailMessage); return(true); } catch (Exception ex) { throw ex; } }
public bool sendNewDocumentMail_MC_Local_WithAttchment(string MCID, string mailReciever, string docName, string senderName, string attachmentfile, string attachmentfile1, string des, string agy, string MsgSend) { bool isSuccess = false; try { ProjectConfi1 pconfig = new ProjectConfi1(); string urlDomain = System.Configuration.ConfigurationManager.AppSettings["connectionUrl"].ToString(); MailAddress _fromMailAddress = new MailAddress(pconfig.MailSenderEmail, pconfig.MailSenderDisplayName); MailAddress _bccMailAddress = new MailAddress(pconfig.MailSenderEmail, pconfig.MailSenderDisplayName); SmtpClient smtpClient = new SmtpClient(); smtpClient.Host = pconfig.MailServer; smtpClient.Port = pconfig.MailPort; smtpClient.EnableSsl = pconfig.MailIsSSL; smtpClient.UseDefaultCredentials = true; smtpClient.Credentials = new NetworkCredential(pconfig.MailSenderUsername, pconfig.MailSenderPassword); MailMessage _mailMessage = new MailMessage(); _mailMessage.IsBodyHtml = true; _mailMessage.From = _fromMailAddress; _mailMessage.Bcc.Add(_fromMailAddress); string[] ToAddresses = mailReciever.Split(new char[] { ';' }); for (int i = 0; i < ToAddresses.Length; i++) { if (ToAddresses[i] != "") { _mailMessage.To.Add(new MailAddress(ToAddresses[i])); } } _mailMessage.Subject = HttpUtility.HtmlEncode(docName.ToString()); if (attachmentfile != null) { _mailMessage.Attachments.Add(new Attachment(attachmentfile)); } if (attachmentfile1 != null) { _mailMessage.Attachments.Add(new Attachment(attachmentfile1)); } string HtmlBody = MsgSend.ToString(); _mailMessage.Body = (HtmlBody); //smtpClient.EnableSsl = true; _mailMessage.IsBodyHtml = true; smtpClient.Send(_mailMessage); isSuccess = true; } catch (Exception expout) // Exception Raised in Between whole program { if (expout.Message != "") { return(isSuccess); } } return(isSuccess); }
public bool SendAlertEmail_MC_NIC_WithAttachment(string MCID, string mailReceiver, string docname, string senderName, string attachmentfile, string attachmentfile1, string des, string agy, string MsgSend) { try { ProjectConfi1 pconfig = new ProjectConfi1(); string urlDomain = System.Configuration.ConfigurationManager.AppSettings["connectionUrl"].ToString(); MailAddress _fromMailAddress = new MailAddress(pconfig.MailSenderEmail, pconfig.MailSenderDisplayName); MailAddress _bccMailAddress = new MailAddress(pconfig.MailSenderEmail, pconfig.MailSenderDisplayName); SmtpClient smtpClient = new SmtpClient(); smtpClient.EnableSsl = false; smtpClient.Host = pconfig.MailServer; smtpClient.Port = pconfig.MailPort; smtpClient.EnableSsl = pconfig.MailIsSSL; smtpClient.UseDefaultCredentials = true; smtpClient.Credentials = new NetworkCredential(pconfig.MailSenderUsername, pconfig.MailSenderPassword); MailMessage _mailMessage = new MailMessage(); _mailMessage.IsBodyHtml = true; _mailMessage.From = _fromMailAddress; _mailMessage.Bcc.Add(_fromMailAddress); if (attachmentfile != null) { _mailMessage.Attachments.Add(new Attachment(attachmentfile)); } if (attachmentfile1 != null) { _mailMessage.Attachments.Add(new Attachment(attachmentfile1)); } string[] ToAddresses = mailReceiver.Split(new char[] { ';' }); for (int i = 0; i < ToAddresses.Length; i++) { string[] mRec = ToAddresses[i].Split(new Char[] { '|' }); if (mRec[0] != "") { _mailMessage.To.Add(new MailAddress(mRec[0].ToString())); } } _mailMessage.Subject = HttpUtility.HtmlEncode(docname.ToString()); string HtmlBody = MsgSend; _mailMessage.Body = (HtmlBody); //smtpClient.EnableSsl = true; _mailMessage.IsBodyHtml = true; smtpClient.Send(_mailMessage); //} //} return(true); } catch (Exception ex) { throw ex; } }
public bool SenMailFeedback_Local(string UserName, string Message) { bool isSuccess = false; try { ProjectConfi1 pconfig = new ProjectConfi1(); string urlDomain = System.Configuration.ConfigurationManager.AppSettings["connectionUrl"].ToString(); MailAddress _fromMailAddress = new MailAddress(pconfig.MailSenderEmail, pconfig.MailSenderDisplayName); MailAddress _bccMailAddress = new MailAddress(pconfig.MailSenderEmail, pconfig.MailSenderDisplayName); SmtpClient smtpClient = new SmtpClient(); smtpClient.Host = pconfig.MailServer; smtpClient.Port = pconfig.MailPort; smtpClient.EnableSsl = pconfig.MailIsSSL; smtpClient.UseDefaultCredentials = true; smtpClient.Credentials = new NetworkCredential(pconfig.MailSenderUsername, pconfig.MailSenderPassword); MailMessage _mailMessage = new MailMessage(); _mailMessage.IsBodyHtml = true; _mailMessage.From = _fromMailAddress; _mailMessage.Bcc.Add(_fromMailAddress); _mailMessage.To.Add("*****@*****.**"); _mailMessage.Subject = "Feedback mail from " + UserName; string HtmlBody = Message.ToString(); _mailMessage.Body = (HtmlBody); //smtpClient.EnableSsl = true; _mailMessage.IsBodyHtml = true; smtpClient.Send(_mailMessage); isSuccess = true; } catch (Exception expout) // Exception Raised in Between whole program { if (expout.Message != "") { return(isSuccess); } } return(isSuccess); }
public bool SendApproveMail(string comment, string WorkshopId, string workshop, string Subject, string mailReceiver, string senderName, string des, string agy, string status, string attach = "") { try { ProjectConfi1 pconfig = new ProjectConfi1(); string urlDomain = System.Configuration.ConfigurationManager.AppSettings["connectionUrl"].ToString(); MailAddress _fromMailAddress = new MailAddress(pconfig.MailSenderEmail, pconfig.MailSenderDisplayName); MailAddress _bccMailAddress = new MailAddress(pconfig.MailSenderEmail, pconfig.MailSenderDisplayName); SmtpClient smtpClient = new SmtpClient(); smtpClient.Host = pconfig.MailServer; smtpClient.Port = pconfig.MailPort; smtpClient.EnableSsl = pconfig.MailIsSSL; smtpClient.UseDefaultCredentials = true; smtpClient.Credentials = new NetworkCredential(pconfig.MailSenderUsername, pconfig.MailSenderPassword); MailMessage _mailMessage = new MailMessage(); _mailMessage.IsBodyHtml = true; _mailMessage.From = _fromMailAddress; _mailMessage.Bcc.Add(_fromMailAddress); // Response.ContentType = "application/pdf"; string pdfFilePath = Server.MapPath("~") + "writedata/South/" + WorkshopId; if (Directory.Exists(pdfFilePath)) { _mailMessage.Attachments.Add(new Attachment(pdfFilePath + "/" + "South-SouthVisitRequest" + WorkshopId + ".pdf")); } if (attach != "") { _mailMessage.Attachments.Add(new Attachment(attach)); } string[] ToAddresses = mailReceiver.Split(new char[] { ';' }); for (int i = 0; i < ToAddresses.Length; i++) { string[] mRec = ToAddresses[i].Split(new Char[] { '|' }); if (mRec[0] != "") { _mailMessage.To.Add(new MailAddress(mRec[0].ToString())); _mailMessage.Subject = HttpUtility.HtmlEncode(Subject.ToString()); } } string HtmlBody = " <table style='width: 80%;height: 196px;'> " + " <tr>" + " <td style=' height: 25px;font-family: Arial, Helvetica, sans-serif; font-weight: bold; background-color: #008000; color: #FFFFFF; border: thin ridge #006600'> " + " EAPDEA</td> " + " </tr> " + " <tr> " + " <td style='font-family: Arial, Helvetica, sans-serif; background-color: #DAFED6; color: #5E8C8C; height: 94px;'> " + " Greetings, " + " <br /> " + " <br /> " + " Mr. " + senderName + " , " + des + " , " + agy + " has " + status + " your workshop " + workshop + " " + " <p style='font-family: Arial, Helvetica, sans-serif; font-size: 11px; font-weight: bold; font-style: normal; color: #000000;'>Details of Document <br/> " + " Subject : " + workshop + " has been " + status + "<br />" + " Sent By : " + senderName + ", " + des + ", " + agy + "<br /> " + " Date Recieved: " + DateTime.Now.ToString("dd MMM yyyy") + "<br /></p> " + " Thanks and Regards</td> " + " </tr><tr></tr><tr><td>For any query, please contact Sanjeev Mathur at [email protected] <br/>" + " </td></tr></table>"; _mailMessage.Body = (HtmlBody); // smtpClient.EnableSsl = true; _mailMessage.IsBodyHtml = true; smtpClient.Send(_mailMessage); return(true); } catch (Exception ex) { throw ex; } }
public bool SendStudyTourMail(string SendTo, string PipeLineType, string PipeLineName, string CreateName, string Place, string DateOfVisit, string FileName) { bool isSuccess = false; try { ProjectConfi1 pconfig = new ProjectConfi1(); string urlDomain = System.Configuration.ConfigurationManager.AppSettings["connectionUrl"].ToString(); MailAddress _fromMailAddress = new MailAddress(pconfig.MailSenderEmail, pconfig.MailSenderDisplayName); MailAddress _bccMailAddress = new MailAddress(pconfig.MailSenderEmail, pconfig.MailSenderDisplayName); SmtpClient smtpClient = new SmtpClient(); smtpClient.Host = pconfig.MailServer; smtpClient.Port = pconfig.MailPort; smtpClient.EnableSsl = pconfig.MailIsSSL; smtpClient.UseDefaultCredentials = true; smtpClient.Credentials = new NetworkCredential(pconfig.MailSenderUsername, pconfig.MailSenderPassword); MailMessage _mailMessage = new MailMessage(); _mailMessage.IsBodyHtml = true; _mailMessage.From = _fromMailAddress; _mailMessage.Bcc.Add(_fromMailAddress); string[] ToAddresses = SendTo.Split(new char[] { ';' }); for (int i = 0; i < ToAddresses.Length; i++) { if (ToAddresses[i] != "") { _mailMessage.To.Add(new MailAddress(ToAddresses[i])); } } _mailMessage.Subject = HttpUtility.HtmlEncode("Workshop Study Tours Details"); string HtmlBody = " <table style='width: 80%;height: 196px;'> " + " <tr>" + " <td style=' height: 25px;font-family: Arial, Helvetica, sans-serif; font-weight: bold; background-color: #008000; color: #FFFFFF; border: thin ridge #006600'> " + " EAPDEA</td> " + " </tr> " + " <tr> " + " <td style='font-family: Arial, Helvetica, sans-serif; background-color: #DAFED6; color: #5E8C8C; height: 94px;'> " + " Dear Sir/Ma'am, " + " <br /> " + " <br /> " + " You have receive Study Tours Details, please login to " + " <a href='http://eapdea.gov.in/Login.aspx'>www.eapdea.gov.in</a> with your dedicated " + " username and password.<br /> " + " <p style='font-family: Arial, Helvetica, sans-serif; font-size: 11px; font-weight: bold; font-style: normal; color: #000000;'>Workshop Details of Official Outgoing/Incomming Details<br/> " + " Subject : Study Tours for " + PipeLineType + " Place- " + Place + " against " + PipeLineName + " <br />" + //" PipeLine Type : " + PipeLineType + "<br />" + " Place : " + Place + "<br /> " + " Date of Visit : " + DateOfVisit + "<br /> " + " Send By : " + CreateName + "<br /> " + " Date Recieved: " + DateTime.Now.ToString("dd MMM yyyy") + "<br /></p> " + " Thanks and Regards</td> " + " </tr><tr></tr><tr><td>For any query, please contact Sanjeev Mathur at [email protected] <br/>" + " </td></tr></table>"; //if (FileName != null) // _mailMessage.Attachments.Add(new Attachment(FileName)); _mailMessage.Body = (HtmlBody); _mailMessage.IsBodyHtml = true; smtpClient.Send(_mailMessage); isSuccess = true; } catch (Exception expout) // Exception Raised in Between whole program { if (expout.Message != "") { return(isSuccess); } } return(isSuccess); }
public bool SendRsetPasswordLinkMail(string UserEmail, string UniqueId) { ProjectConfi1 pconfig = new ProjectConfi1(); string urlDomain = System.Configuration.ConfigurationManager.AppSettings["connectionUrl"].ToString(); MailAddress _fromMailAddress = new MailAddress(pconfig.MailSenderEmail, pconfig.MailSenderDisplayName); MailAddress _bccMailAddress = new MailAddress(pconfig.MailSenderEmail, pconfig.MailSenderDisplayName); SmtpClient smtpClient = new SmtpClient(); smtpClient.Host = pconfig.MailServer; smtpClient.Port = pconfig.MailPort; smtpClient.EnableSsl = pconfig.MailIsSSL; smtpClient.UseDefaultCredentials = true; smtpClient.Credentials = new NetworkCredential(pconfig.MailSenderUsername, pconfig.MailSenderPassword); MailMessage _mailMessage = new MailMessage(); _mailMessage.IsBodyHtml = true; _mailMessage.From = _fromMailAddress; _mailMessage.Bcc.Add(_fromMailAddress); // _mailMessage.CC.Add("*****@*****.**"); string[] mailids = UserEmail.Split(','); foreach (string id in mailids) { _mailMessage.To.Add(new MailAddress(id)); } //_subject= "Regarding your Credentials"; _mailMessage.Subject = HttpUtility.HtmlEncode("forgot Password Link"); string HtmlBody = "<table width='100%' cellspacing='0' cellpadding='0' style='margin:0;padding:0;width:100%;font-family:'Helvetica Neue','Helvetica',Helvetica,Arial,sans-serif'>"; HtmlBody = HtmlBody + "<tbody>"; HtmlBody = HtmlBody + "<tr style='margin:0;padding:0'>"; HtmlBody = HtmlBody + "<td style='margin:0;padding:0'></td>"; HtmlBody = HtmlBody + "<td bgcolor='#F6F6F6' style='margin:0 auto!important;padding:0;background:#f6f6f6;display:block!important;max-width:800px!important;clear:both!important'>"; HtmlBody = HtmlBody + "<br style='margin:0;padding:0'>"; HtmlBody = HtmlBody + "<div style='margin:0 auto 15px;padding:0;max-width:600px;border-radius:3px;display:block;background:#fff'>"; HtmlBody = HtmlBody + "<div style='margin:0;padding:0 15px'>"; HtmlBody = HtmlBody + "<table cellspacing='0' cellpadding='0' style='margin:0;padding:0;width:100%'>"; HtmlBody = HtmlBody + "<tbody><tr style='margin:0;padding:0'>"; HtmlBody = HtmlBody + "<td style='margin:0;padding:0'></td>"; HtmlBody = HtmlBody + "<td bgcolor='#fff' style='margin:0 auto!important;padding:15px 0;background:#fff;border-bottom:1px solid #e9e9e9;display:block!important;max-width:800px!important;clear:both!important'>"; HtmlBody = HtmlBody + "<table width='100%' cellspacing='0' cellpadding='0' style='margin:0;padding:0'>"; HtmlBody = HtmlBody + "<tbody><tr style='margin:0;padding:0'>"; HtmlBody = HtmlBody + "<td valign='top' align='center' width='100' style='margin:0;padding:0'>"; HtmlBody = HtmlBody + "<img alt='PPR' style='width:50px;Float:Left;' src='https://mofapp.nic.in/EFC/images/emblem.png'><p style='color: #DD9F68;font-size: 24px;'><u>EAPDEA Portal</u></p>"; HtmlBody = HtmlBody + "</td>"; HtmlBody = HtmlBody + "</tr>"; HtmlBody = HtmlBody + "</tbody></table>"; HtmlBody = HtmlBody + "</td>"; HtmlBody = HtmlBody + "<td style='margin:0;padding:0'></td>"; HtmlBody = HtmlBody + "</tr>"; HtmlBody = HtmlBody + "</tbody></table>"; HtmlBody = HtmlBody + "</div>"; HtmlBody = HtmlBody + "<div style='margin:0;padding:0 15px'>"; HtmlBody = HtmlBody + "<table width='100%' cellspacing='0' cellpadding='0' style='margin:0;padding:0'>"; HtmlBody = HtmlBody + "<tbody><tr style='margin:0;padding:0'>"; HtmlBody = HtmlBody + "<td style='margin:0;padding:0'>"; HtmlBody = HtmlBody + "<br style='margin:0;padding:0'>"; HtmlBody = HtmlBody + "<p style='margin:0;padding:0;margin-bottom:5px;color:#585858;font-weight:400;font-size:13px;line-height:1.6'></p>"; HtmlBody = HtmlBody + "<br style='margin:0;padding:0'>"; // HtmlBody = HtmlBody + "<p style='margin:0;padding:0;margin-bottom:5px;color:#585858;font-weight:400;font-size:13px;line-height:1.6'>" + " <a href='https://eapdea.gov.in/ppr//ResetPassword.aspx'>Click Here to Reset Your Password</a>" + "</p>"; HtmlBody = HtmlBody + "</td>"; HtmlBody = HtmlBody + "</tr>"; HtmlBody = HtmlBody + "</tbody></table>"; HtmlBody = HtmlBody + "</div>"; HtmlBody = HtmlBody + "<br style='margin:0;padding:0'>"; HtmlBody = HtmlBody + "<div style='margin:0;padding:0 15px'>"; HtmlBody = HtmlBody + "<table width='100%' cellspacing='0' cellpadding='0' style='margin:0;padding:0'>"; HtmlBody = HtmlBody + "<tbody><tr style='margin:0;padding:0'>"; HtmlBody = HtmlBody + "<td width='30%' style='margin:0;padding:0;margin-bottom:15px;font-weight:bold;font-size:12px;min-width:100px;max-width:100%;display:inline-block;vertical-align:top'>"; HtmlBody = HtmlBody + "<p style='margin:0;padding:0;margin-bottom:5px;color:#1a1a1a;font-weight:bold;font-size:14px;line-height:1.6'>One Time Password Is:-</p>"; HtmlBody = HtmlBody + "</td>"; HtmlBody = HtmlBody + "<td width='30%' style='margin:0;padding:0;margin-bottom:15px;font-weight:bold;font-size:12px;min-width:100px;max-width:100%;display:inline-block;vertical-align:top'>"; HtmlBody = HtmlBody + "<p style='margin:0;padding:0;margin-bottom:5px;color:#1a1a1a;font-weight:bold;font-size:14px;line-height:1.6'>" + UniqueId + "</p>"; HtmlBody = HtmlBody + "</td>"; HtmlBody = HtmlBody + "</tr>"; HtmlBody = HtmlBody + "<tr style='margin:0;padding:0'>"; HtmlBody = HtmlBody + "<td width='20%' align='right' style='margin:0;padding:0;margin-bottom:15px;font-weight:bold;font-size:12px;min-width:100px;max-width:100%;display:inline-block;vertical-align:top'>"; HtmlBody = HtmlBody + "<a href='http://eapdea.gov.in' target='_blank' alt='Check EAPDEA Portal' style='margin:0;padding:5px 10px;color:#fff;background:#f5861f;display:inherit;text-decoration:none;text-align:center;line-height:30px;width:190px;height:30px;border-radius:3px;font-weight:600;font-size:12px;outline:0;border:0' data-saferedirecturl='http://eapdea.gov.in'>Click Here To Check EAPDEA Portal </a>"; HtmlBody = HtmlBody + "</td>"; HtmlBody = HtmlBody + "</tr>"; HtmlBody = HtmlBody + "<tr><td colspan='2' style='font:12px arial;color:#333;text-align:justify'><hr><br><b>This is a system generated mail. Please do not reply to this email ID.Mail sent to this address cannot be answered.<br>(1) You Are Still Having Problems? If you're still having difficulty retrieving your password please use forgot Password Link contact system Administrator. <br>(2) This request was made on :- " + DateTime.Now.ToString("dd MMM yyyy") + "</b> <br><hr><br></td></tr>"; HtmlBody = HtmlBody + "</tbody></table>"; HtmlBody = HtmlBody + "</div>"; HtmlBody = HtmlBody + "<br style='margin:0;padding:0'>"; HtmlBody = HtmlBody + "<div style='margin:0;padding:0 15px;background:#fbfbfb'>"; HtmlBody = HtmlBody + "<br style='margin:0;padding:0'>"; HtmlBody = HtmlBody + "<table width='100%' cellspacing='0' cellpadding='0' style='margin:0;padding:0'>"; HtmlBody = HtmlBody + "<tbody><tr style='margin:0;padding:0'>"; HtmlBody = HtmlBody + "<td style='margin:0;padding:0'>"; HtmlBody = HtmlBody + "<table width='100%' border='0' cellspacing='0' cellpadding='0' style='font-family:Arial,Helvetica,sans-serif;font-size:11px;color:#9b9b9b;margin:0;padding:0'>"; HtmlBody = HtmlBody + "<tbody style='margin:0;padding:0'>"; HtmlBody = HtmlBody + "<tr style='margin:0;padding:0'>"; HtmlBody = HtmlBody + "<td align='center' style='margin:0;padding:0'>"; HtmlBody = HtmlBody + "© 2018-NIC. All Rights Reserved."; HtmlBody = HtmlBody + "</td>"; HtmlBody = HtmlBody + "</tr>"; HtmlBody = HtmlBody + "</tbody>"; HtmlBody = HtmlBody + "</table>"; HtmlBody = HtmlBody + "</td>"; HtmlBody = HtmlBody + "</tr>"; HtmlBody = HtmlBody + "</tbody></table>"; HtmlBody = HtmlBody + "<table width='100%' cellpadding='0' cellspacing='0' border='0' align='center' style='font-family:Arial,Helvetica,sans-serif;font-size:10px;padding:10px 0;color:#9b9b9b;margin:0'>"; HtmlBody = HtmlBody + "<tbody style='margin:0;padding:0'>"; HtmlBody = HtmlBody + "<tr style='margin:0;padding:0'>"; HtmlBody = HtmlBody + "<td align='center' width='33.3333%' style='margin:0;padding:0'>Department of Economic Affairs, Ministry of Finance Site designed, hosted by National Informatics Centre</td>"; HtmlBody = HtmlBody + "</tr>"; HtmlBody = HtmlBody + "</tbody>"; HtmlBody = HtmlBody + "</table>"; HtmlBody = HtmlBody + "<br style='margin:0;padding:0'>"; HtmlBody = HtmlBody + "</div>"; HtmlBody = HtmlBody + "</div>"; HtmlBody = HtmlBody + "</td>"; HtmlBody = HtmlBody + "<td style='margin:0;padding:0'></td>"; HtmlBody = HtmlBody + "</tr>"; HtmlBody = HtmlBody + "</tbody>"; HtmlBody = HtmlBody + "</table>"; _mailMessage.Body = (HtmlBody); _mailMessage.IsBodyHtml = true; smtpClient.Send(_mailMessage); return(true); }
public bool sendNewDocumentMail_MC_Local_NotAttachment(string MCID, string mailReciever, string docName, string senderName, string attachmentfile, string attachmentfile1, string des, string agy) { bool isSuccess = false; try { ProjectConfi1 pconfig = new ProjectConfi1(); string urlDomain = System.Configuration.ConfigurationManager.AppSettings["connectionUrl"].ToString(); MailAddress _fromMailAddress = new MailAddress(pconfig.MailSenderEmail, pconfig.MailSenderDisplayName); MailAddress _bccMailAddress = new MailAddress(pconfig.MailSenderEmail, pconfig.MailSenderDisplayName); SmtpClient smtpClient = new SmtpClient(); smtpClient.Host = pconfig.MailServer; smtpClient.Port = pconfig.MailPort; smtpClient.EnableSsl = pconfig.MailIsSSL; smtpClient.UseDefaultCredentials = true; smtpClient.Credentials = new NetworkCredential(pconfig.MailSenderUsername, pconfig.MailSenderPassword); MailMessage _mailMessage = new MailMessage(); _mailMessage.IsBodyHtml = true; _mailMessage.From = _fromMailAddress; _mailMessage.Bcc.Add(_fromMailAddress); string[] ToAddresses = mailReciever.Split(new char[] { ';' }); for (int i = 0; i < ToAddresses.Length; i++) { if (ToAddresses[i] != "") { _mailMessage.To.Add(new MailAddress(ToAddresses[i])); } } _mailMessage.Subject = HttpUtility.HtmlEncode(docName.ToString()); string HtmlBody = " <table style='width: 80%;height: 196px;'> " + " <tr>" + " <td style=' height: 25px;font-family: Arial, Helvetica, sans-serif; font-weight: bold; background-color: #008000; color: #FFFFFF; border: thin ridge #006600'> " + " EAPDEA</td> " + " </tr> " + " <tr> " + " <td style='font-family: Arial, Helvetica, sans-serif; background-color: #DAFED6; color: #5E8C8C; height: 94px;'> " + " Greetings !!, " + " <br /> " + " <br /> " + " You have received a new document, please login to " + " <a href='http://eapdea.gov.in/Login.aspx'>www.eapdea.gov.in</a> with your dedicated " + " username and password.<br /> " + " <p style='font-family: Arial, Helvetica, sans-serif; font-size: 11px; font-weight: bold; font-style: normal; color: #000000;'>Details of Document <br/> " + " Subject : " + docName + "<br />" + " Document Type : Mission Clearance<br />" + " Mission Clearance ID : " + MCID + "<br /> " + " Sent By : " + senderName + ", " + des + ", " + agy + "<br /> " + " Date Recieved: " + DateTime.Now.ToString("dd MMM yyyy") + "<br /></p> " + " Thanks and Regards</td> " + " </tr><tr></tr><tr><td>For any query, please contact Sanjeev Mathur at [email protected] <br/>" + " </td></tr></table>"; _mailMessage.Body = (HtmlBody); _mailMessage.IsBodyHtml = true; smtpClient.Send(_mailMessage); isSuccess = true; } catch (Exception expout) // Exception Raised in Between whole program { if (expout.Message != "") { return(isSuccess); } } return(isSuccess); }