Пример #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));
        }
Пример #2
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));
        }