when sending a newsletter or other automated emails that are template-based, it is very useful to be able to use a template for the body of the email and populate it with values (commonly known as a "Mail Merge").
currently we do it in CFML with the CF variables embedded into the mail body like: Dear #contact#
but that has many downsides, for example it requires the template to be created by a CF programmer or else the code will break if # signs are not escaped for example.
we can easily add two attributes to cfmail like:
then the body of the email will be read from the passed template file and if a MailMerge struct was pased – the text and other related fields (like subject) will be processed with the enhanced replace( input, structValues ).
a sample template text can be as simple as:
RAILO-2338 this will make sending newsletters and automated emails easier than ever.