- Contact Script

Last updated June 11, 02004. is a relatively simple script that gives you a "contact" page without requiring the use of an email on the page itself (helps fight spam). I use one instance of it to do all the contact pages under and a variety of other domains I host. It has the following groovy features:

    It has a number of spam-fighting features to prevent the script from being misused.

    It can be used across multiple domains. I host a number of domains, and each domain owner can use this one script to have contact pages under their particular domain.

    It will only send mail to domains and virtual hosts on the server. And it can only be called from the same local server. In other words, it prevents from being used to relay spam (expcept possibly to you).

    It can "target" specific directories. I have several "free standing" websites under different directories ( e.g. my furniture site, my travel site ). I use the same script to allow someone to contact me from a variety of different pages, and respond with different templates.

    It uses a simple template and style sheet to control the output (if redirect is not specified on the contact form), allowing the results to match the colors of a specific site or directory.


This script is both free, and open source software, licensed under the GNU / GPL license. You are free to modify it and redistribute it (as long as you include the source - see the license for details).


   - perl 5.x (including the HTML::Template module)
   - sendmail, or much better still, qmail    - a web server

Installation and usage

Using the script is pretty self explanatory. Unzip the folder wherever you keep your source code. Put into your cgi-bin, set your execute permissions, then modify the clearly labeled "user variables" at the top of the script.

Put contact.htm, contactResult.htm and style.css in your root web directory (typically /home/httpd/html). If you want to use it from one or more specific subdirectories, you can a) put copies of contact.htm and contactResults in that sub-directory, and set the hidden "directory" tag in contact.htm to the targeted subdirectory, eg "/furniture" or "/travel" or "/furniture/portfolio" etc. Of course you'll probably want to change the HTML of both contact.htm and the results template, contactResults.htm. Just don't delete the TMPL variables in contactResults.htm.