smsohan / MvcMailer

A Mailer for ASP.Net MVC that forms the Email Body using MVC Views (Razor etc.) following Ruby on Rails ActionMailer style
MIT License
582 stars 178 forks source link

Logging generated email body #154

Open hemantvikram opened 8 years ago

hemantvikram commented 8 years ago

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.