andrewdavey / postal

Email sending for asp.net mvc using the view engine system to render emails.
http://aboutcode.net/postal
MIT License
536 stars 168 forks source link

Can you view the finished email as a string, rather than a ViewResult? #146

Open deanebarker opened 8 years ago

deanebarker commented 8 years ago

I'm using Postal from a class deep within my app, so it's not being called from a controller. I'd like to just see the rendered output as a string. Is this possible?

codymaust commented 8 years ago

If you use the Postal.EmailService.CreateMailMessage method to convert it to a System.Net.Mail.MailMessage object, you can inspect the MailMessage.Body property to view the body as a string.

It's outlined here http://aboutcode.net/postal/create-mail-message.html

And MSDN reference https://msdn.microsoft.com/en-us/library/system.net.mail.mailmessage(v=vs.110).aspx