Templates
When sending an email using RenderMessageAndSend the following will be parsed for the message and removed what's left is sent as the body.
from: name <address> or address
to: address,address
cc: address,address
bcc: address,address
subject: value
X-header: value
body text
If the body text contains '<html>' it will be sent as html.
By default layouts will not be applied. It looks for views stored in
Common if the view name starts with a /. Otherwise it looks for
views in the Mail folder.
-
/MailTemplate.brail should be stored in views/common/MailTemplate.brail
- MailTemplate.brail should be stored in views/mail/MailTemplate.brail
Testing
The test support doesn't currently render the message, but you can check for the number of message sent and the template name and properties.
Assert.That(MessagesSent.Length, Is.EqualTo(2));
Assert.That(RenderedEmailTemplates[0].Name, Is.EqualTo("MailTemplate"));
Assert.That(RenderedEmailTemplates[0].Parameters["to"], Is.EqualTo(emails[0]));
In the MessageSent Collection all the messages are hard coded as
new Message("from", "to", "subject", "body");Also added to using.castleproject.org Sending Email With RenderViewAndSend