I'm understanding him to mean that he has is a variable stored inside of
another variable.

He queries the database and gets  query.variable
When he   <cfoutput>#query.variable#</cfoutput>, it literally gives  "Dear
#first_name#"
He then wants to be able to display the value of #first_name#.  So, what
he's trying to do is evaluate a variable stored within another variable in 1
pass.

Neil, try something like   #Evaluate(mail_message)#

You can try it with a little test like this:

<cfset test1 = "Bob">
<!--- Escape the # signs --->
<cfset test2 = "##test1##">

<cfoutput>
    #test1#<br>
    #test2#<br>
    #Evaluate(test2)#
</cfoutput>

If you simply <cfoutput> test2, then you get '#test1#', but if you evaluate
it, you get 'Bob', which, I believe, is what you are after.

Todd Ashworth

| <SNIP>
| I am trying to set up a mail system that can grab text from a database and
| insert it into a mail message. I also need to customize the text of the
| message (e.g. Dear #first_name# evaluates to Dear John). The problem
arises
| when I insert the mail text variable into the <cfmail> tag. The variables
| that are contained in the text message are not evaluated.
| <cfmail ..>
| #mail_message#
| </cfmail>
| This will output "Dear #first_name#, ..."
|
| How do I get the sub variable to be evaluated?
| </SNIP>
|
| Neil,
| Are you querying the database first?  Try to do something like this:
|
| <CFQUERY NAME="Query" DATASOURCE="DSN">
| SELECT *
| FROM SomeTable
| </CFQUERY>
| blah blah blah
| <CFMAIL QUERY="Query"...>
| Dear #first_name#,
| blah blah blah
| </CFMAIL>


------------------------------------------------------------------------------
Archives: http://www.mail-archive.com/cf-talk@houseoffusion.com/
To Unsubscribe visit 
http://www.houseoffusion.com/index.cfm?sidebar=lists&body=lists/cf_talk or send a 
message to [EMAIL PROTECTED] with 'unsubscribe' in the body.

Reply via email to