Example #1
0
 //Function for ApplicationErrorMail
 /// <summary>
 /// Function for ApplicationErrorMail
 /// </summary>
 public static bool ApplicationErrorMail(string ErrorDetails)
 {
     MailTemplate template = new MailTemplate(MailTemplate.Templates.ApplicationError);
     //fetch subject and contents
     string Subject = template.Subject;
     System.Text.StringBuilder Body = new System.Text.StringBuilder(template.Body);
     //set contents
     Body = Body.Replace("[ERRORDETAILS]", ErrorDetails);
     //send email
     return Send(ConfigureApplicationErrorMail(ErrorDetails, new MailMessage()));
 }
Example #2
0
 // Special case function for ELMAH (only configure email)
 /// <summary>
 /// Configure email
 /// </summary>
 /// <param name="ErrorDetails">Error details</param>
 /// <param name="mailMsg">MailMessage to configure</param>
 /// <returns>MailMessage</returns>
 public static MailMessage ConfigureApplicationErrorMail(string ErrorDetails, MailMessage mailMsg, string physicalApplicationPath = "")
 {
     MailTemplate template = new MailTemplate(MailTemplate.Templates.ApplicationError, physicalApplicationPath);
     //fetch subject and contents
     string Subject = template.Subject;
     System.Text.StringBuilder Body = new System.Text.StringBuilder(template.Body);
     //set contents
     Body = Body.Replace("[ERRORDETAILS]", ErrorDetails);
     //configure email
     mailMsg.From = new MailAddress(Config.ContactEmail);
     mailMsg.To.Clear(); // Provide comma sep as per - http://msdn.microsoft.com/en-us/library/ms144695.aspx
     mailMsg.To.Add(Config.ApplicationErrorEmail);
     mailMsg.Subject = Subject;
     mailMsg.Body = Body.ToString() + mailMsg.Body; // Prepand our dody info
     return mailMsg;
 }
Example #3
0
        //Function to send claim comment mail
        /// <summary>
        /// Function to send Assign To change claim email
        /// </summary>
        /// <param name="Comment">Claim comment</param>
        /// <param name="ClaimId">Claim Id</param>
        /// <param name="AssignToEmail">Email of the user to whom the Claim has been Assigned</param>
        /// <returns>True if sent</returns>
        public static bool AssignToMail(string ClaimNo, string Comment, int ClaimId, string AssignToEmail, string Assigner, bool FromComment)
        {
            MailTemplate template = new MailTemplate(MailTemplate.Templates.ClaimAssignTo);
            //fetch subject and contents
            string Subject = template.Subject.Replace("[CLAIM#]", ClaimNo);
            System.Text.StringBuilder Body = new System.Text.StringBuilder(template.Body);
            //set contents
            string claimLink = //FromComment ? Defaults.trimLastURLSegment(HttpContext.Current.Request.Url.ToString()) : HttpContext.Current.Request.Url.ToString();
            HttpContext.Current.Request.Url.GetLeftPart(UriPartial.Authority) +
            new System.Web.Mvc.UrlHelper(HttpContext.Current.Request.RequestContext).Action("Manage?", "Claim", new { ClaimID = ClaimId });

            claimLink = System.Web.HttpUtility.UrlDecode(claimLink);//.TrimEnd(new char[] { '?' });//Need to add Manage? so that mvc doesn't remove default action, now trim it.

            Body = Body.Replace("[CLAIM#]", ClaimNo).Replace("[ASSIGNER]", Assigner).Replace("[COMMENT]", Comment).Replace("[LINK]", claimLink);
            //send email
            return Send(ConfigureMailMessage(Config.ContactEmail, AssignToEmail, Body.ToString(), Subject, ""));
        }
Example #4
0
 //Function to send forget password mail
 /// <summary>
 /// Function for forget password mail
 /// </summary>
 /// <param name="userEmail">User Email</param>
 /// <param name="password">User Password</param>
 /// <returns>true if the email is sent successfully</returns>
 public static bool ForgotPwdMail(string UserEmail, string Password, string From)
 {
     MailTemplate template = new MailTemplate(MailTemplate.Templates.ForgotPwd);
     //fetch subject and contents
     string Subject = template.Subject;
     System.Text.StringBuilder Body = new System.Text.StringBuilder(template.Body);
     //set contents
     Body = Body.Replace("[EMAIL]", UserEmail).Replace("[PASSWORD]", Password);
     //send email
     return Send(ConfigureMailMessage(From, UserEmail, Body.ToString(), Subject, ""));
 }