Where can I find an example of Formmail script using Blat.exe?

Download Formmail zip

The download that is included with this article has been modified to work with the web server. However, it needs further adjustment to be completely integrated with each web site.


Download and unzip the included file above and reference the example below. There are three important files contained within the zip file:

1. Form.html - This is the front end web page enabling a user to fill in a message body, subject, and from address, in a form. This information is passed to emailform.pl for processing.

2. emailform.pl - This is the back end script which sends the message with the web server component Blat.exe. The file also contains settings about how the script works.

3. Thanks.html - This web page will display thanks if submission is successful.

Modify and then place these files in the cgi-bin folder for the web site. The link to the form should use the following format:
where EXAMPLE.com is your domain name.

Local settings can be found in the Control Center.
If you have not already, login to the Control Center at
and from the menu item SITE click on SITE SETTINGS.

These pages can be opened up in a web site editor, or note pad.

Modifying the emailform.pl page

Rename the file from emailform.pl to something else to protect it from conventional detection. If the name of the file is left as emailform.pl, it will be removed from the servers. You can use rename it to email.pl for example.

There are four lines in the .pl (PERL) file that need modification because they reflect settings of the script. Some of these settings require a local path. Find the local path to the root in the Control Center by logging into
and from the menu item SITE select SITE OVERVIEW.

1. $tempdir - this is where the script needs to temporarily create the message.

2. $logfile - this file is where the script will keep history of successful or unsuccessful attempts to send the message. This file needs to be created manually if you want to keep a history of attempts.

3. @referrers - This is a list of domain names that are allowed to access the script.

4. @recipients - This is a list of domain names that are allowed to receive the email message.

Also, see the commented notes within the emailform.pl file for more specific information and definitions. This example describes the minimum settings changes needed. You can always customize the script further if you are familiar with PERL.

Modifying the form.html page

1. Change the post action within the form to reflect the URL path of your .pl script.
The link to the script should use the following format:
where EXAMPLE.com is your domain name.

2. Change the recipient value to the email address the form will send to.

** Make sure that there is no "id=" in the email input line such as: <input name="email" id="email" size=25>

For more information about formmail, and for other PERL script examples please visit http://www.worldwidemart.com/scripts/, which is where the script originated from.

** The directory that includes the tempdir and log file needs write permissions. If they are in the cgi-bin, write permissions are turned on by default.

** The settings, @referrers and @recipients are highly important. The @recipients setting prevents others from spamming your email address. The @referrers setting prevents other sites from processing mail using your emailform.pl with their own form by linking to your emailform.pl.

** The web service SendMail is not installed to the web servers. Instead, please use blat.exe.

Add Feedback