How to pass url with Smart Mailer and insert record

This tutorial will walk you through the process of creating a form that a user can fill out, the results are inserted into a database and a personalized mail is send to the user based on a template. I am using a url parameter to pass the user's name to the template page that is send to the user by mail.

I created a pdf file of this tutorial. You can download it by clicking on the Code Download link in the blue properties box.

Smart Mailer ASP - Send mail with insert record.

How do you send mail, insert a record and pass a url parameter?

You created a form that the user fills in. You would like to insert this info into a database and mail the user with a Thank you for your interest. But how can you personalize such a mail? How do you use the URL parameter?


How to do it

Open page

Open your asp file that displays a form with the  submit button that you will use to send the newsletter. I named my textfields name, address, company and email.

Create the variables

To create variables from the name, address, company and email entries, open the Bindings panel. Click on the + sign and select Request Variable. From the dropdown box select Request.Form and in the Name field, enter the names of the fields from your form. Repeat until you have variables for all the fields in your form.

Apply Smart Mailer extension: Main

You can find the Smart Mailer extension under Server Behaviors | DMXzone | Smart Mailer.
There are 4 tabs: Main, Content, Attachments, Setup.

Main:
Here you can enter where the mail will come from and where it is going to. In this case I dynamically selected the name from the user by clicking on the lightning bolt icon.

Select One Receiver. Choose Bcc if you want to have a confirmation sent to yourself.
In the Submitting field, choose On Form Submit. This will send the mail as soon as a user hits the submit button.

Apply Smart Mailer: Content

In Subject, I chose to enter a Thank you from DMXzone.
Content Type should be set to HTML, since the template is html based. When you select the option "Embed images in E-mail", all the images in the newsletter will be sent with the mail, making the mail larger. Not selecting this option will result in the recipient not seeing the images, if their machine is  not connected to the internet when they read the mail.

In Body I chose Template. Locate for the template file by clicking the browse button. Select the asp page that you would like to be sent and select Parameters. In the Name I entered name to get the value of name. Under Value, I dynamically choose the name from the name field.



This passes the URL parameter to the mail.asp page. In the code it will look like this:

sm1.setBody_Template_html "mail.asp?name=" & Request.Form("name") & ""

George Petrov

George PetrovGeorge Petrov is a renowned software writer and developer whose extensive skills brought numerous extensions, articles and knowledge to the DMXzone- the online community for professional Adobe Dreamweaver users. The most popular for its over high-quality Dreamweaver extensions and templates.

George is also the founder of Wappler.io - the most Advanced Web & App Builder

See All Postings From George Petrov >>

Comments

Be the first to write a comment

You must me logged in to write a comment.