Adding an email form to any page
It is easy to add an email form to any page – and you can even pre-load the subject of the email and who the message will be sent to. Here’s how.
There will be occasions when you will want to include a email form (like the one below) within your web pages. For example, you might be asking for feedback on an article, or providing a way for readers to contact you about something you have written about.
You can easily add an email form like this one:
Adding an eMail form to your pages
- On any content page or department, include the following code where you wish the email form to appear:
<cfinclude template=”programs/sendmail.cfm”>
- View and test the form.
That’s all you have to do.
Controlling the subject, the send to address, and the thank you page
If you wish to have complete control over the email form, you can use the following options:
- Send-to – by default all email forms will be sent to webmaster@yoursite.com. You can change that by including the following above the call to the email form:
<cfset sendto=”yourname@yoursite.com”>
The only restriction is that the email address must be one assigned to your site.
- Subject Line – By default the subject line of the email form is left blank to be filled out by those who use the form. You can ‘pre-load’ the subject line by including the following code:
<cfset subject=”Example Mail form”>
Change the value to that of the subject line you wish to appear.
- Thank You Page – by default, when a visitor uses the mail form, they will be shown the default thankyou page (always content page 3 on your website). The page will usually look like: http://www.membergate.com/public/3.cfm
You might want a different thank you page to appear. To do that, include the following code:
<cfset thankyou=”http://www.membergate.com/public/3.cfm”>
The value is full URL link to the thank you page, including the http://
- The Message – By default the message area of the email form is left blank to be filled out by those who use the form. You can ‘pre-load’ the area by including the following code:
<cfset message=”I’d love to see a tutorial on . . .”>
An example
The following is an example of a mail form that sends an email to bmyers@membergate.com, with the subject line, ‘tutorial request’, with the thank you page being ‘112’.
<cfset subject=”MemberGate tutorial request”>
<cfset sendto=”bmyers@membergate.com”>
<cfset thankyou=”http://www.membergate.com/members/113.cfm”>
<cfset message=”I’d love to see a tutorial on . . .”>
<cfinclude template=”programs/sendmail.cfm”>
Are you into beautiful Costa Rica?
All interesting things you want to know about Costa Rica are right here in our newsletter! Enter your email and press "subscribe" button.