public ActionResult Publish(Guid id) { if (!CheckPermission(NewsletterPermissions.ManageNewsletters)) { return(new HttpUnauthorizedResult()); } var newsletter = newsletterService.GetById(id); var subscribers = newsletterService.GetSubscribers(); var message = new MailMessage(); foreach (var triple in subscribers) { if (!string.IsNullOrEmpty(triple.Third)) { int languageId = int.Parse(triple.Third); var language = WorkContext.Resolve <ILanguageService>().GetById(languageId); if (language != null) { var translatedNewsletter = newsletterService.GetByLanguage(id, language.CultureCode); if (translatedNewsletter != null) { message.Subject = translatedNewsletter.Title; message.Body = translatedNewsletter.BodyContent; } else { message.Subject = newsletter.Title; message.Body = newsletter.BodyContent; } } else { message.Subject = newsletter.Title; message.Body = newsletter.BodyContent; } } else { message.Subject = newsletter.Title; message.Body = newsletter.BodyContent; } message.To.Add(new MailAddress(triple.Second, triple.First)); messageService.SendEmailMessage(message); } return(new AjaxResult().NotifyMessage("UPDATE_ENTITY_COMPLETE")); }