Smart Mailer ASP Support Product Page

This topic was archived

Smart Mailer - how to merge fields into template

Reported 17 Jul 2007 08:52:25
1
has this problem
17 Jul 2007 08:52:25 Justin Moss posted:
I was recently scouring the DMXZone forums and was frustrated by the lack of support and tutorials offered on DMXZone in relation to the Smart Mailer extension. As evidenced by these posts, so too are many of you:

<b>Related posts (without clear solutions):</b>

"SmartMailer dynamic 'remove me' link on template" www.dmxzone.com/forum/topic.asp?topic_id=30323
"Will Smart Mailer work like a Mail Merge?" www.dmxzone.com/forum/topic.asp?topic_id=28092
"Sending an asp template with dynamic selection" www.dmxzone.eu/forum/topic.asp?topic_id=28873
"Unsubscribe to the newsletter" www.flzone.net/forum/topic.asp?topic_id=25413
"Not passing variables" www.dmxzone.com/forum/topic.asp?topic_id=25315
and to some degree .. "Dynamic templates:" www.fwzone.net/forum/topic.asp?topic_id=25147

A scan of the few responses that were provided suggest somewhat nebulous advice, whilst those that were provided by DMXZone certainly didn't commit to a tutorial, or an update of the existing tutorials. I have been a supporter of DMXZone for many years, and frankly I am disheartened by their lack of response (some of these issues have gone unanswered for years) on this issue - not the norm by any means, but a worrying trend.

With surprisingly very little effort and experimentation I was able to determine a solution for the following task:

<b>Task</b>: How to mail merge fields into template using Smart Mailer ASP

<b>My requirements:</b> My initial needs were are almost completely summarised by the "Newsletter" tutorial provided (www.dmxzone.com/ShowDetail.asp?NewsId=5626), except that I wanted my template to add a salutation and a name (eg "Dear Sarah" in the body of the email (not the subject line) - this is a popular need, but not at all well addressed in the tutorials or reply posts (I am happy to be corrected on this matter). In this particular case I wanted to conditionally display the salutation (ie, only if a name was available) and take only the first name (if a full name had been entered).

<b>Quick summary of method:</b> Pass extra variables from the email recordset (say "txtRecipientName" in the query string THEN request the querystring in the template.

<b>Changes to make:</b>

<b>1)</b> in your <u>Send Form</u> - to the <u>sm1.setBody_Template_html</u> statement, add additional querystring parameters for each 'merge' field you need eg.

<font color=orange>sm1.setBody_Template_html "mailtemplate.asp?idNewsletter=" & Request.Form("idNewsletter" & "&Client=" & Request.Form("inClient" & "&inRecipientName="&rsNamesAndEmails.Fields.Item("txtName".Value</font id=orange>

<b>2)</b> in your <u>Email Template</u> - add to the body (where required) a request.querystring to retrieve the field you need (place it where you need it). In the following example I've also included code to pull only the first name (and trap first names only word names)

<font color=orange>&lt;!-- Customise personal salutation --&gt;
&lt;%if request.querystring("inRecipientName"&lt;&gt;"" then %&gt;
&lt;% if (instr(request.QueryString("inRecipientName"," ")&lt;&gt;0 then%&gt;
&lt;% varName= left(request.QueryString("inRecipientName",(instr(request.QueryString("inRecipientName"," ")-1)%&gt;
&lt;%else%&gt;
&lt;% varName= request.QueryString("inRecipientName"%&gt;
&lt;%end if%&gt;
Dear &lt;%=varName%&gt;,
&lt;%else%&gt;
&lt;%end if%&gt;
&lt;!-- Insert text or first block of text --&gt;
&lt;%=rsNewsletters.Fields.Item("IntroText".Value%&gt;
</font id=orange>

I've just sent an email to 3,600 recipients, so I can attest to the fact that this approach works. I hope all of this is of some help to those looking to build a email marketing system using 'mail merge' type fields in templates.

All the best,
Justin

PS. In the above articles, I will post a link to this post.

Edited by - justinmoss on 17 Jul 2007 08:54:16

Replies

Replied 17 Jul 2007 11:09:19
17 Jul 2007 11:09:19 Georgi Kralev replied:
Hi Justin,

Thank you very much for all your solutions and contribution.

But, I believe that this topic is for the General forum of Smart Mailer Asp (not for Bugs).
General section could be found at through the following link:
www.dmxzone.com/forum/forum.asp?forum_id=1014&NewsId=5578

Also, please check the following Topic before posting at Bug forum:
www.dmxzone.com/forum/topic.asp?topic_id=38922&NewsId=5578

Additional information for Smart Mailer could be found at the following links:
* Smart Mailer ASP Official page: www.dmxzone.com/ShowDetail.asp?NewsId=5578
* Smart Mailer ASP FAQs: www.dmxzone.com/index.asp?TypeId=7&CatId=709
* Support Forums: www.dmxzone.com/forum/default.asp?NewsId=5578

Example of dynamic template:
dmxzone.com/forum/topic.asp?topic_id=38621&NewsId=5578

I hope you will find this information useful.

Regards,






Georgi Kralev

----------------------------------
Support - www.DMXzone.com
Replied 27 Sep 2007 09:59:03
27 Sep 2007 09:59:03 George Zirfas replied:
This is absolutely fabulous for you ASP guys. I guess I'm the only one using the PHP Smart Mailer. Since two of my servers only provide php and not asp with the rest supporting both, I got the PHP version. Believe it or not the two php sites were bigger clients for me. I searched the PHP forum and did not find any corresponding posts to handle this same thing. I know I'm in the wrong forum but can you help me do the same thing with the Smart Mailer PHP? I've tried and failed.

Reply to this topic