public void SendMail(List <Email> emails, Settings settings) { // Add all the emails to the email table // They are sent every X seconds by the email sending task foreach (var email in emails) { // Sort local images in emails email.Body = StringUtils.AppendDomainToImageUrlInHtml(email.Body, settings.ForumUrl.TrimEnd('/')); Add(email); } }
public void SendMail(List <Email> emails, Settings settings) { // Sort out the email body foreach (var email in emails) { // Sort local images in emails email.Body = StringUtils.AppendDomainToImageUrlInHtml(email.Body, settings.ForumUrl.TrimEnd('/')); } // Now batch add to hangfire, 25 emails at a time foreach (var emailList in emails.ChunkBy(25)) { // Fire with hangfire BackgroundJob.Enqueue <EmailService>(x => x.ProcessMail(emailList)); } }