-
Notifications
You must be signed in to change notification settings - Fork 24
OnMailSending is never executed #36
Copy link
Copy link
Open
Description
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();
Is there an example on how to implement OnMailSending ?
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
No labels