| 1. |
First, create the form you want to have site visitors fill out. It should have at least a few text fields, and a submit button, like this (this one is just a dummy, and doesn't work): |
|
|
| 2. |
Next, Download the FormMail script. This link will prompt you to download a zip file containing the FormMail script and a "read me" file explaining how to use the script. |
|
|
| 3. |
Unzip the file and open the "FormMail.pl" file with a program like notepad (NOT Microsoft Word). Edit the line in the script that reads "mydomain.com", by replacing "mydomain.com" with the actual name of your domain. |
|
|
| 4. |
Upload the FormMail.pl file to your cgi-bin. This will require you to use an FTP client such as SmartFTP (although nearly any FTP client will do). Make sure you upload in ASCII mode, and NOT "bin" or "binary". |
|
|
| 5. |
Change permissions on the script to 755. For most FTP clients this involves right clicking on the file on the server side and choosing a command similar to "Set Permissions". Your FTP client may require you to choose "read", "write", and "execute", or "rwx" style permissions, in which case you want "rwxr-xr-x". |
|
|
| 6. |
In the form you will call the script from (e.g., "orderform.html"), there are an absolute minimum of two things you must do: |
|
|
| |
| A. |
Set the form action to "/cgi-bin/FormMail.pl". Be careful, as capitalization is important. Your form action might look something like:
<form method="post" action="/cgi-bin/FormMail.pl"> |
|
|
|
| |
| B. |
Set a recipient - the person to receive the email results of the form. This is done with a hidden field in your HTML code that looks like:
<input type="hidden" name="recipient" value="me@mydomain.com">
Of course, you substitue your email address for "me@mydomain.com". Note that the "mydomain.com" should correspond with the domain name the script is being used on. Anything else will require a more complex configuration of the FormMail.pl script itself. |
|
|
|
| 7. |
You can also add a "redirect" hidden field. This would send site visitors to a "Thank You" page you've designed. The hidden field would look like:
<input type="hidden" name="redirect" value="thank_you.html"> |
|
|
| 8. |
If you name the text box where you collect the visitor's email address "email" (and NOT "Email" or "e-mail"), then the form, when received, will look like it came from that address. |
|
|
| |
NOTE: Of course, the "thank_you.html" page would have to be one you've already created and uploaded to the site (and can certainly have a different name than "thank_you"). If you don't create a thank you page and set the redirect hidden field, the person who submits the form will see a simple page showing the content of the form they've submitted. |
|
|
| 8. |
Finally, upload everything (hint - the "orderform.html" and "thank_you.html" pages go in your "httpdocs" directory, and the "FormMail.pl" script goes in your cgi-bin), and test your script. The four most common problems are:
1. The permissions aren't set to 755.
2. The domain name hasn't been set to match the domain name your setting up the script on.
3. You haven't properly set the action of the form.
4. You haven't properly set a recipient. |