crossvertise / ActionMailerNext

Fork of ActionMailer.Net, A easy to use library to generate emails with razor views
MIT License
42 stars 24 forks source link

Body Not Accessible #27

Open Gabby-Paolucci opened 8 years ago

Gabby-Paolucci commented 8 years ago

The body of the email is always null, as accessible by MailAttributes.TextBody, MailAttributes.HtmlBody, and MailAttributes.Body. The only way I'm able to access the body is by using a method I found in \src\ActionMailerNext.Tests\Standalone\RazorMailerBaseTests.cs:

var body = new StreamReader(email.MailAttributes.AlternateViews[0].ContentStream).ReadToEnd().Trim();

This method only works before delivering the email; if it's used after delivering the email, it returns an empty string. Also, using this method before delivering the email clears out the contents of the email. Thus, I'm forced to generate the email twice, once to send, and second time to get the body.

Gabby-Paolucci commented 8 years ago

Looking through the source code, MailAttributes.TextBody, MailAttributes.HtmlBody, and MailAttributes.Body are never set to anything; they'll always be null. Are they obsolete or not yet implemented?