FormMail - Sending E-mail from a Web Form
FormMail is a special script designed to allow you to send e-mails based on the input from an HTML form on your
website.
Important Security Information
NOTE: Prior to 8 March, 2002, FormMail for the Virtual Private Server used the
source from Matt's Script Archive. This version (version 1.91) of FormMail has a number of significant security holes
which allow malicious users to relay messages through a vulnerable server.
NMS FormMail is a drop-in replacement for the orignal script which overcomes the security problems associated with
FormMail, and is now being provided on the Virtual Private Servers. We strongly urge anyone using FormMail to switch
to the NMS version if they are not already using it.
NMS FormMail was specifically designed to be compatible with the original FormMail script, and should not require you
to make any changes to your HTML forms already in use when you switch to the NMS version.
NMS FormMail is a drop-in replacement
for the orignal script which overcomes the security problems associated with FormMail. We strongly urge anyone
using FormMail to switch to the NMS version if they are not already using it.
NMS FormMail was specifically designed to be compatible with the original FormMail script, and should not require
you to make any changes to your HTML forms already in use when you switch to the NMS version.
Installing NMS FormMail
The following instructions will guide you through the process of installing NMS
Hosting account.
Back Up your Current FormMail
If you already have a version of FormMail running on your account, you should make a copy of it
before installing the NMS FormMail script.
Dowload the NMS FormMail script to your local computer
Click on the link below to download the NMS FormMail script to your local computer. Save the file to a location
where you can easily find it after you have downloaded the file.
http://nms-cgi.sourceforge.net/
Unzip and Edit the FormMail.pl file
You will need to extract the FormMail.pl file from the formmail.zip file. You can do this by opening formmail.zip
using WinZip (or some other .zip file extraction program) and right-clicking on FormMail.pl and selecting Extract
from the context menu. Select a loction where you can remember and extract the file.
Once you have extracted the file, you will need to open it and edit some values. Open the file using NotePad or your
favorite text editor. Scroll down to the User Configuration Section and find the following line.
$mailprog = '/usr/lib/sendmail -oi -t';
Change the path to use /usr/sbin/sendmail instead of /usr/lib/sendmail. The line should now look like this:
$mailprog = '/usr/sbin/sendmail -oi -t';
Next, you need to edit the domain names allowed to use the form. Find the following line in the script
(it should be just a few lines down):
@referers = qw(dave.org.uk 209.207.222.64 localhost);
Remove dave.org.uk and 209.207.222.64 and put your Hosting Account domain name in. For
example, if your domain name were MY-DOMAIN.NAME, the line should look like this when you are done:
@referers = qw(MY-DOMAIN.NAME localhost);
You will also need to change the allowed recipients. The next line in the FormMail.pl script looks
like this:
@allow_mail_to = qw(you@your.domain some.one.else@your.domain localhost);
Remove you@your.domain and some.one.else@your.domain and enter your Basic Plus Hosting account domain name. The
line should look like this if your domain name were MY-DOMAIN.NAME:
@allow_mail_to = qw(MY-DOMAIN.NAME localhost);
This will allow FormMail to send e-mail to any valid username on your Hosting Account. You can
also specify specific recipient addresses in this field. For example, if you wanted to be able to send
mail only to the user ME@MY-DOMAIN.NAME, you would simply add ME@MY-DOMAIN.NAME instead of just
MY-DOMAIN.NAME to the list.
When you are done editing the file, save it (as the same name) and exit the text editor.
Upload the script to your Hosting Account
- Connect to your Hosting Account using Control Panel or an FTP client.
- Change to your www/cgi-bin folder by clicking on the folder names in the File Manager window.
- Click on Upload File in the Actions menu.
- Click on the Browse... button and find the FormMail.pl file on your local computer in the Browse
window. Click on Open after you have selected the file to return to the main window, then select
Upload File to copy the file to your Basic Plus Hosting account.
- Once you've uploaded the file, you need to make it executable. To do this, select the FormMail.pl
script in the File Manager and select Change Permissions. You will then need to select Advanced
Permissions and click on the checkboxes to make the script Executable by Owner, Group, and World (0755).
Click on Set New Permissions to make the changes take effect.
Create an HTML Form
If you already have a form, it should now be using the new FormMail.pl script. If it does not work, check to make sure
that you are using the correct path to the script and that the script has the same domain and account as your form uses.
If you don't already have an HTML form, create a new file in your www/htdocs/ directory using the File Manager and
create one. The following code is an example of how to use FormMail. You may want to adapt the code for your
specific use.
<form method="POST" action="/cgi-bin/FormMail.pl">
<input type="hidden" name="recipient" value="order@yourdomain.com">
<input type="hidden" name="subject" value="Order Request">
<input type="hidden" name="required" value="realname,e-mail,phone">
Please Enter Your Name:<br>
<input name="realname" size="40">
<p>
Please Enter Your E-mail Address:<br>
<input name="e-mail" size="40">
<p>
Please Enter Your Phone Number:<br>
<input name="phone" size="40">
<p>
.
.
.
<input type="submit" value="Submit">
<input type="reset" value="Reset">
</form>
Once you have the form in place, test it to make sure that it works properly.
Documentation

|