MvcMailer icon indicating copy to clipboard operation
MvcMailer copied to clipboard

Logging generated email body

Open hemantvikram opened this issue 9 years ago • 0 comments

Hi smsohan,

        var client = new SmtpClientWrapper();
        client.SendCompleted += SendEmailCompleted;

void SendEmailCompleted(object sender, System.ComponentModel.AsyncCompletedEventArgs e) { var mailMsg = sender as System.Net.Mail.SmtpClient; //mailMsg.message <--What is the alternate way? var emailLog = new EmailLog {}; }

I would like to log the generated message body to the database to keep history of emails sent. When debugging I found that the sender object (SmtpClient) has a variable "message" that holds the generated body and other information pertaining to email but this is not available implementation wise. So, Is it possible to include this as a feature in you next version?

Thanks, Hemant.

hemantvikram avatar Nov 19 '15 12:11 hemantvikram