WebHare 4.16 adds PrepareMailWitty as a replacement for the MakeEmailComposer API. We may deprecate the old API in the far future. New projects should always use the new API .
with the following Wittytemplate:
PrepareMailWitty can wrap the email in a template by specifying a witty resource as the 'mailtemplate' option. A mailtemplate looks like this:
The slot[name=mailbody] element is replaced with the original email. Stylesheets, mailsubjects and wh-mailcomposer- metatags are also merged into the original email.
Once you've switched to using PrepareMailWitty it's easy to add a debug/test option in your Tollium applications. Although this is not required it will be useful when building and testing mail templates.
To ensure your preview and live versions don't diverge too much, you should wrap your PrepareMailWitty call in a function that's shared by both. For example:
Then, it's a simple matter of invoking the emailtest dialog in a tollium action:
A dialog will open which will automatically refresh itself if you update the underlying witty files, similar to this:
- PrepareMailWitty supports the wh-mailcomposer metatags to specify from, to, cc and bcc values, and to apply templates
- Embed RTD documents (EmbedRTD)
- Relative image paths are resolved relative from the emailresource, and embedded in the final mail
- Resource image paths (eg <img src="mod::mymodule/...">) are supported and will be embedded
- Emails are restructured for compatibility (RestructureEmailForCompatibility) by writing out <style> information to style= attributes, setting target="_blank" to links, reapplying styles to <a> tags, etc.
- AddAttachment(Relative), AddAlternative
- Use a component from a witty instead of the entire witty by adding :component to the witty path