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.
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?
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:
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.