|
|
|
 |
| Using ASP Forms
|
ASP Form Mail Script: Step 1 >
Download File
Download the file below by clicking on the name of the file or right-clicking
and selecting "Save Target As..." from the subsequent menu. Be sure to save the
file to your desktop or other place where you can easily find it.
File to Download: aspFormMail.zip
Step 2 > Extract Downloaded ZIP
File
Extract the contents of the .zip file downloaded above in Step 1 to the same
convenient location. Once extracted, you should have a folder called aspFormMail
that contains the following files:
-
aspFormMail.asp
- the file that contains the code to email your form information.
-
MailFooter.inc
- an include file that contains the footer information for the application.
-
MailHeader.inc
- an include file that contains the header information for the application.
-
readme.txt - a text file containing application information for
customizing and testing the mail form application. It is recommended you read
this file before implementation.
-
sample.html - a sample form that illustrates how to build your form and
how the aspFormMail system is implemented.
Step 3 > Upload aspFormMail Folder
to Your Website
Copy the extracted aspFormMail folder, and the files contained within it, to
your website. This folder should be placed in the same directory as the form
that you want to send email from. This is usually the top-level directory of
your website.
Step 4 > Modify Your Form to Use
New File
The last step is to make your form use the new file to email you the
information you have collected in your form. Open the desired form in the HTML
editor of your choice and modify the action attribute of the form tag to the
following:
<form method="post" action= "/aspFormMail/aspFormMail.asp">
Now your form is set to email you the information that was submitted to it. You
can use this method on any HTML form you like...try it!
CONFIGURATION AND USE > Complete
information is contained in the readme.txt File
Customizing ASP Form Mailer
-
Open the aspFormMail.asp file with Notepad.
-
Scroll down till you see the *** USER CONFIGURATION *** section.
-
Change the information in that section as neccessary to suit your website.
-
Allowed referers are the sites which can use the aspFormMail.asp file
-
The default from address will be used if the email address supplied by the user
is invalid.
-
The mail will be sent to the default to address if you don't specify one in the
form.
Customizing The Error Message Pages
-
Open the MailHeader.inc file with Notepad. This file contains the text above
the error message.
-
Edit it to reflect the style of your website. The two neccessary things for it
to have are the closing </head> tag and the opening <body> tag.
-
Save the changes and close the file.
-
Repeat with MailFooter.inc, which is the text below the error message. Make
sure you change the email link to point to your email address. This file must
contain the closing </body> and </html> tags.
Testing ASP Form Mailer
-
Right-click on the sample.html file and select Edit.
-
Change the email address in the ToEmail field to your address.
-
Change the web address in the RedirectURL field to a page on your site.
-
Upload aspFormMailer.asp, MailHeader.inc, MailFooter.inc and sample.html to the
same directory on your website.
-
Point your browser to the sample.html file.
-
To test it fully:
-
Leave either the Name or Email fields (or both if you'd rather ;) ) blank, and
it should give you an error message.
-
Using the following (incorrect) email addresses should give you errors:
-
An address with the '@' as the first character
-
An address with the '@' as the last character
-
An address with no '@' in it altogether
-
An address with two '@' symbols in it
-
An address with no period after the '@'
-
An address with the last period less than two spaces before the end (incorrect
suffix), e.g. bob@there.c
-
An address with the first character after the '@' being a period
-
Make sure you get an email with the results if you fill it out completely.
-
Edit the sample.html file and reupload it to check the Anonymous To-Email
function works.
Supported Variables
- FromEmail:
-
The email address of who filled the form in.
<input type="text" name="FromEmail">
The FromEmail will be checked by the script. If it is invalid, and 'NeedEmail'
is set to Yes, the user will be given an error message explaining why. If
'NeedEmail' is set to No, the only checking that will be done is if the length
is zero; if that is the case, the default address will be used.
- FromName:
-
Who filled the form in.
<input type="text" name="FromName">
- ToEmail:
-
Who the email will be sent to.
<input type="hidden" name="ToEmail" value="you@your.domain"
ID="Hidden12">
or <input type="hidden" name="ToEmail" value="you">
(see 'Anonymous To-Email' for further information)
- ToName:
-
The name of who the email will be sent to.
<input type="hidden" name="ToName" value="Bob Smith">
- EmailSubject:
-
What the subject of the email will be.
<input type="hidden" name="EmailSubject" value="Your form results">
- RedirectURL:
-
The URL the user will be redirected to after filling your form out.
<input type="hidden" name="RedirectURL"
value="http://www.yourdomain.com">
- Env_Report:
-
Sends a report of browser type, IP etc with the email; by default it is "No".
<input type="hidden" name="Env_Report" value="Yes">
- Sort:
-
The order the fields should be sent in. Can be "Alphabetical", "FormOrder" (the
order they are in your form, which is the default option) or user specified:
"field1, field2, field4, field3,..." etc.
<input type="hidden" name="Sort" value="Alphabetical">
- Print_Config:
-
The list of config fields to be sent in the email. Configuration fields are
"FromName" "ToEmail" "ToName" "Print_Config" "RedirectURL" and "Print_Blank".
If none are specified, then none will be sent.
<input type="hidden" name="Print_Config" value="FromName,RedirectURL">
- Print_Blank:
-
Should blank fields be emailed anyway? By default it is "No".
<input type="hidden" name="Print_Blank" value="Yes">
- Required:
-
The list of fields which the user must fill out before the form is mailed. If
they are not filled out the user will get an error message saying which ones
need to be filled.
<input type="hidden" name="Required" value="FromEmail,FromName,Comments">
- NeedEmail:
-
If the from email address must be valid; can be either "Yes" or "No", with the
default being No. If it is invalid with this set to "Yes", the user will be
given an error message explaining what is wrong with it.
<input type="hidden" name="NeedEmail" value="Yes">
|
Terms of Use |
Phone: 805-692-6900 Toll Free: 866-SBWH-COM Email:
© 2006 SBWH, Inc. All rights reserved.
|
|
|
|
|