Esempio n. 1
0
        public static MailMessage GetErrorEmail(Exception err)
        {
            var templatePath = HttpContext.Current.Server.MapPath("~/Views/EmailTemplates/Error.cshtml");

            var body = EmailTemplateResolver.GetEmailBody(
                templatePath,
                err);

            return(new MailMessage(
                       StaticConfig.MailSenderAddress,
                       StaticConfig.MailErrorAddress,
                       "Error In " + StaticConfig.SiteName,
                       body));
        }
Esempio n. 2
0
        public static MailMessage GetContactEmail(ContactMailModel model)
        {
            var templatePath = HttpContext.Current.Server.MapPath("~/Views/EmailTemplates/Contact.cshtml");

            var body = EmailTemplateResolver.GetEmailBody(
                templatePath,
                model);

            return(new MailMessage(
                       StaticConfig.MailSenderAddress,
                       "*****@*****.**",
                       "Conatct From DIYFE",
                       body));
        }
Esempio n. 3
0
        public static MailMessage GetWebContact(string contactName, string email, string message)
        {
            var templatePath = HttpContext.Current.Server.MapPath("~/Views/EmailTemplates/WebContact.cshtml");

            var body = EmailTemplateResolver.GetEmailBody(
                templatePath,
                new
            {
                ContactName  = contactName,
                ContactEmail = email,
                Message      = message
            });

            return(new MailMessage(
                       AppStatic.MailSenderAddress,
                       AppStatic.MailErrorAddress,
                       "Web Contact",
                       body));
        }
Esempio n. 4
0
        public static MailMessage GetWelcomeEmail(string toAddress, string userName, string userFullName, string password, string loginUrl)
        {
            var templatePath = HttpContext.Current.Server.MapPath("~/Views/EmailTemplates/Welcome.cshtml");

            var body = EmailTemplateResolver.GetEmailBody(
                templatePath,
                new
            {
                UserName = userName,
                FullName = userFullName,
                Password = password,
                LoginUrl = loginUrl
            });

            return(new MailMessage(
                       StaticConfig.MailSenderAddress,
                       toAddress,
                       "Welcome to our site!",
                       body));
        }