private void SendEmail(FunnelWebSettings settings, CommentPostedEvent commentDetails) { try { var client = new SmtpClient(); client.EnableSsl = settings.SmtpUseSsl; client.Port = settings.SmtpPort; client.Host = settings.SmtpServer; client.DeliveryMethod = SmtpDeliveryMethod.Network; if (!string.IsNullOrEmpty(settings.SmtpPassword)) { client.Credentials = new NetworkCredential(settings.SmtpUsername, settings.SmtpPassword); } var message = new MailMessage(settings.SmtpFromEmailAddress, settings.SmtpToEmailAddress); message.Subject = (commentDetails.Comment.IsSpam ? "[Spam] " : "") + "Comment on " + commentDetails.Entry.Title; message.Body = BuildMessageBody(commentDetails.Entry, commentDetails.Comment); message.IsBodyHtml = true; client.Send(message); } catch (Exception ex) { Trace.WriteLine(ex); } }
public MetaWeblog( ISettingsProvider settingsProvider, IRepository repository, ISession session, IFileRepository fileRepository, IAuthenticator authenticator) { this.repository = repository; this.session = session; this.fileRepository = fileRepository; this.authenticator = authenticator; funnelWebSettings = settingsProvider.GetSettings<FunnelWebSettings>(); }
public virtual ActionResult Settings(FunnelWebSettings settings) { ViewBag.Themes = ThemeProvider.GetThemes(); if (!ModelState.IsValid) { ModelState.AddModelError("", "Your settings could not be saved. Please fix the errors shown below."); return View(settings); } SettingsProvider.SaveSettings(settings); return RedirectToAction("Settings", "Admin") .AndFlash("Your changes have been saved"); }