----- Original Message -----
Sent: Friday, November 08, 2002 2:13
AM
Subject: [iMS] token fields
Hello,
I'm trying to use cfx_imsmail to send out a
newletter. In the newsletter I need to replace certain strings (tokens
??) with values from a database query. From what i can see in the
documentation, the way to do this is to open a query then use the QUERY &
QUERYFIELD parameters to specify the query and the field in the query I
want to send the email to. How then do I specify something like "[name]"
to be replaced in the email with the name field from the database
??
This what i have so far ::
<cfscript>
htmlcontent =
'<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01
Transitional//EN">
<html>
<head>
<title>Untitled</title>
</head>
<body>
Dear [name],
<br><br>
sdfasdf
asd fa<br>
sdf asfasf<br><br>
<font >This is the email content, testing the ims
sender....</font>
<br><br><br>
asfasdf
!!!!
</body>
</html>';
</cfscript>
<cfquery name="getmembers"
datasource="test">
SELECT member_email,
member_name
FROM member_
ORDER BY
member_id
</cfquery>
<cfx_imsmail query="getmembers"
QUERYFIELD="member_email" header_subject="This is a real test"
smtpfrom="[EMAIL PROTECTED]" header_from="IMS -
VERVE" smtpto="[EMAIL PROTECTED]" body="Dear
[name], Blah blah blah blah blah blah blah"
html="#htmlcontent#">
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
- - - - - - - - - - - - -
- - - - - - -
So then how do i use the token.... parameter to
specify that i want to replace the value "[name]" with the field "member_name"
from the query ??
You'll need to specify the field as
a query token by specifying it in your tag parameters like:
qtoken_name="member_name"
Then, in the body of the message
you use name as a token and you delimit it with the default delimiters
like:
<:name:>
So, your code becomes:
<cfx_imsmail query="getmembers"
QUERYFIELD="member_email" qtoken_name="member_name" header_subject="This
is a real test"
smtpfrom="[EMAIL PROTECTED]" header_from="IMS - VERVE" smtpto="[EMAIL PROTECTED]"
body="Dear <:name:>, Blah blah blah blah blah blah blah"
html="#htmlcontent#">
** also.. for testing purposes - i've noticed
that if i have the same email address in the database multiple times - only 1
email will be sent... is this correct ?? .. is there a way to override this
?
No, there is not way to override
this other than doing a cfloop over the cfx tag. The reason that iMS
works this way is because you would normally not want one email address
receiving the same email.
Regards,
Howie
thanks in advance