Neil,

>
>       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?
>

I haven't tried this myself, but have a go with :
<cfmail ..>
        #evaluate(mail_message)#
</cfmail>

You might better off using placeholders tho.
So you'd have something like this as your text in the DB:

Dear ~firstname~ ~lastname~,

Thank you for registering your purchase of ~productname~
.
.
.

Then you read the this into your mail_message variable and use replace to
insert the data into the appropriate places before generating your email eg.

<cfset mail_message =
replace(mail_message,"~firstname~",variable.firstname,"ALL")>

[shrug] Dunno...  Have a play... See what you think....

Regards

Stephen

------------------------------------------------------------------------------
Archives: http://www.mail-archive.com/[email protected]/
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