public string Build(MailData data) { var template = new StringBuilder(templateProvider.GetTemplate(data.TemplateName)); template.Replace("{{FirstName}}", data.FirstName); template.Replace("{{Id}}", data.Id); return(template.ToString()); }
protected override void SendInternal(MailData data) { var message = composer.Compose(data); foreach (var address in message.To) { logger.Warn("No-send switch prevented sending message to {0}", address); } }
public MailMessage Compose(MailData data) { var message = new MailMessage { Body = bodyBuilder.Build(data), IsBodyHtml = true, Subject = "Teamborrel / BBQ" }; message.To.Add(addressBuilder.Build(data.Address)); return(message); }
protected override void SendInternal(MailData data) { var message = composer.Compose(data); try { client.Send(message); } catch (Exception e) { var guid = dumper.Dump(message); logger.Error("Failed to send message to {1}. Created dump: {0}", guid, data.FullName()); logger.Error($"Message: {e.Message}"); } foreach (var address in message.To) { logger.Info("Send message to {0}", address); } }
public void Send(MailData data) { SendInternal(data); }
protected abstract void SendInternal(MailData data);