A came across the dumb little trick a while back, and wanted to share this.
I like to make the mail sent from an application look like it’s part of the application, but often the step is overlooked during the development process. However by using <cfinclude> and CSS, this can be accomplished:
<cfmail to=”user@example.com” subject=”Yo!” type=”HTML” from=”anotheruser@example.com”>
<style type=”text/css”>
<cfinclude template=”[path to CSS for site]”>
</style>
[content goes here.]
</cfmail>
Granted, you have to make sure that your CSS not huge, or this becomes inefficient.
The include is nice a neat way of doing this, especially if your generated newsletter email is long and complex. Wrapping a <savecontent/> around the email content can also be an alternative. Then below it you would just output the ‘savecontent’ variable between cfmail tags.
LikeLike