Esempio n. 1
0
        public EmailResult IssueEmail(IssueMailViewModel model)
        {
            bool redirectMails = (WebConfigurationManager.AppSettings["redirectMails"] != null) && bool.Parse(WebConfigurationManager.AppSettings["redirectMails"]);
            string redirectTo = WebConfigurationManager.AppSettings["redirectTo"];

            if (redirectMails && string.IsNullOrEmpty(redirectTo))
                throw new ConfigurationErrorsException("Mail redirecting enabled without a RedirectTo set");

            To.Add(redirectMails ? redirectTo : model.Email);
            From = ConfigurationManager.AppSettings["siteNoReplyEmailAddress"];
            Subject = "An issue occured on you application.";
            return Email("IssueEmail", model);
        }
Esempio n. 2
0
 public void SendIssueMail(ApplicationIssueSeverity severity, string message, string details, IEnumerable<User> users)
 {
     foreach (var user in users)
     {
         var issueEmail = new IssueMailViewModel
         {
             Email = user.Email,
             Severity = severity,
             Message = message,
             Details = details
         };
         new MailController().IssueEmail(issueEmail).Deliver();
     }
 }