private void SendMailApprovalReject(ClaimsDto claim, int status) { try { if (status != 1) { var template = _iClaimHelper.GetMailTemplate(status == 3 ? 1 : 2); var msg = new MailMessage(); //Sender e-mail address. msg.From = new MailAddress("*****@*****.**"); msg.Subject = template.Subject; var body = template.TemplateBody.Replace("@CustomerName", claim.CustomersDto.CustomerName); body = body.Replace("@SrNumber", claim.SrNumber); msg.Body = body; msg.To.Add( "[email protected],[email protected]"); msg.IsBodyHtml = true; //your remote SMTP server IP. var smtp = new SmtpClient { Host = "smtp.gmail.com", Port = 587, Credentials = new System.Net.NetworkCredential("*****@*****.**", "accessaxis"), EnableSsl = true }; smtp.Send(msg); msg = null; } } catch (Exception ex) { } }
private void SendMailOfDocumentationComplete(int claimId) { var url = System.Configuration.ConfigurationManager.AppSettings["url"].ToString() + "Insurer/Index?id=" + Encryption.Encrypt(Convert.ToString(claimId), true); var template = _iClaimHelper.GetMailTemplate(5); var claimsDto = _iClaimHelper.GetClaimByClaimIdForEdit(claimId); try { var msg = new MailMessage(); msg.From = new MailAddress("*****@*****.**"); msg.Subject = template.Subject; var body = template.TemplateBody.Replace("@CustomerName", claimsDto.CustomersDto.CustomerName); body = body.Replace("@ClaimNumber", claimsDto.ClaimNumber); body = body.Replace("@url", url); msg.Body = body; msg.To.Add("[email protected],[email protected],[email protected]"); msg.CC.Add("[email protected],[email protected]"); msg.IsBodyHtml = true; //your remote SMTP server IP. var smtp = new SmtpClient { Host = "smtp.gmail.com", Port = 587, Credentials = new System.Net.NetworkCredential("*****@*****.**", "accessaxis"), EnableSsl = true }; //smtp.EnableSsl = true; smtp.Send(msg); msg = null; } catch (Exception ex) { } }