Zrinity is the leader in enterprise-class email marketing
management solutions and content management solutions for marketing professionals and developers worldwide.
Knowledge BaseCreating Advanced Personalized content with ActivMail
Create customized content for your newsletters
This example requires ActivMail 1.3 or greater
<!--- we are defining a query here with 3 columns num,email,direction --->
<cfset q = QueryNew("num,email,direction")>
<!--- row 1 num=1, email=your@address.com, direction=North --->
<cfset r = QueryAddRow(q)>
<cfset QuerySetCell(q, "num", 1, r)>
<cfset QuerySetCell(q, "email", "your@address.com", r)>
<cfset QuerySetCell(q, "direction", "North", r)>
<!--- row 2 num=2, email=your@address.com, direction=South --->
<cfset r = QueryAddRow(q)>
<cfset QuerySetCell(q, "num", 2, r)>
<cfset QuerySetCell(q, "email", "your@address.com", r)>
<cfset QuerySetCell(q, "direction", "South", r)>
<!--- lets see what the query looks like --->
<cfdump var="#q#">
<!--- we could have also done something like this ---><!---
<cfquery datasource="ds" name="q">
SELECT Num, Email, Direction FROM table
</cfquery>
---><!--- now we have a query defined lets loop through and generate personalized content ---><!--- the content is stored in an array that corresponds to the query row numbers --->
<cfset contentArray = ArrayNew(1)>
<cfoutput query="q">
<cfsavecontent variable="personalContent">
<cfif q.direction IS "North">
<p><b>North</b> is the better direction to go here.
I'm glad you picked north.</p>
<cfelseif q.direction IS "South">
<p><b>South</b> is much better than North.</p>
</cfif>
Your number is #q.num#
</cfsavecontent>
<cfset contentArray[q.currentRow] = personalContent>
</cfoutput>
<cfset QueryAddColumn(q, "content", contentArray)>
<!--- now lets see what the query looks like --->
<br>
<cfdump var="#q#">
<cf_mail
query="q"
tokens="1"
sendmode="query"
to="email"
from="your@address.com"
subject="^direction^ is the way to go!"
tokenchar="^"
type="html">
^content^
<p>
Email: ^email^<br>
Num: ^num^<br>
</p>
personalizedMessage.cfm
</cf_mail>