public void SendNewsPublicationNotification(NewsItem newItem) { if (newItem == null) { throw new ArgumentNullException("new item"); } var account = _emailAccountService.GetEmailAccountById(_emailAccountSettings.DefaultEmailAccountId); var customer = newItem.Customer; var template = _messageTemplateService.GetMessageTemplateByName("NewPublishing"); template.Subject = template.GetLocalized(x => x.Subject, newItem.LanguageId); template.Body = template.GetLocalized(x => x.Body, newItem.LanguageId); var tokens = new List <Token>(); _mesageTokenProvider.AddNewPublishingToken(tokens, newItem); _mesageTokenProvider.AddStoreTokens(tokens); template.Subject = _tokenizer.Replace(template.Subject, tokens, false); template.Body = _tokenizer.Replace(template.Body, tokens, false); var email = new QueuedEmail() { Priority = 3, From = account.Email, FromName = account.DisplayName, To = customer.Email, Subject = template.Subject, Body = template.Body, CreatedOnUtc = DateTime.UtcNow, EmailAccountId = account.Id }; _queuedEmailService.InsertQueuedEmail(email); }