I have a done a CFQUERY and retrieve user's email and name. Then I try to do a CFMAIL something like:
<cfmail to="#user.email#" from="sender@somewhere.com" subject="Message from #sender_name#" type="html">
<table><tr><td>
Dear #receiver_name#
</td></tr>
<tr><td>
#form.message#
</td></tr>
</table>
</cfmail>
This seems to work with CFMAIL and the variables are being populated properly. However, when I placed the content into a template content.cfm because I want to use it somewhere else as well. So content.cfm has:
<table><tr><td>
Dear #receiver_name#
</td></tr>
<tr><td>
#form.message#
</td></tr>
</table>
and the program became:
<cfmail to="#user.email#" from="sender@somewhere.com" subject="Message from #sender_name#" type="html">
<cfinclue template="content.cfm">
</cfmail>
Now the problem is, I am NOT getting the variables (#receiver_name# and#form.message#) populated by Coldfusion when I use the cfinclue template. Why? This is driving me crazy. I don't know why it doesn't work. Thanks in advance.