Open jbreuer opened 7 years ago
I've overriden the OnMailSending method, but it's never hit. This is my controller:
public class EmailController : MailerBase { public EmailResult BaseEmail(BaseEmailViewModel mail) { this.MailAttributes.From = new MailAddress(mail.MailFrom); this.MailAttributes.To.AddRange(mail.MailTo.Select(s => new MailAddress(s))); this.MailAttributes.Bcc.AddRange(mail.MailToBcc.Where(s => !string.IsNullOrWhiteSpace(s)).Select(s => new MailAddress(s))); this.MailAttributes.Subject = mail.MailSubject; this.MailAttributes.MessageEncoding = new UTF8Encoding(); return this.Email("BaseEmail", mail); } protected override void OnMailSending(MailSendingContext context) { //Cancel for testing. context.Cancel = true; base.OnMailSending(context); } }
We send the email like this: new EmailController().BaseEmail(emailViewModel).Deliver();
new EmailController().BaseEmail(emailViewModel).Deliver();
Is there an example on how to implement OnMailSending ?
I've overriden the OnMailSending method, but it's never hit. This is my controller:
We send the email like this:
new EmailController().BaseEmail(emailViewModel).Deliver();
Is there an example on how to implement OnMailSending ?