FormMail CGI

NOTE: Prior to 13 March, 2002, FormMail for the Virtual Private Server used the source from Matt's Script Archive. This version 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.

FormMail is a CGI program designed to generate e-mail based on the input from an HTML form.


To install the FormMail CGI on your Virtual Private Server, connect to your server via Telnet or SSH and do the following:

% vinstall formmail

This command installs two files, and README, into your ~/www/cgi-bin directory.


Create a form that you would like the contents mailed to some address. The form should include the following field (at the very least):

  • recipient = specifies who mail is sent to

Other optional fields can also be used to enhance the operation of FormMail for you site, for example:

  • subject = specify the subject included in e-mail sent back to you
  • email = allow the user to specify a return e-mail address
  • realname = allow the user to input their real name
  • redirect = URL of page to redirect to instead of echoing form input
  • required = list of field names that are required input (comma delimited)

Several other fields are supported. See the README file for a complete presentation of the supported fields.

For example, the HTML source for your form may look like this:

<form method="POST" action="/cgi-bin/">
<input type="hidden" name="recipient" 
<input type="hidden" name="subject" 
       value="Order Request">
<input type="hidden" name="required" 
Please Enter Your Name:<br>
<input name="realname" size="40">
Please Enter Your Email Address:<br>
<input name="email" size="40">
Please Enter Your Phone Number:<br>
<input name="phone" size="40">
<input type="submit" value="Submit">
<input type="reset" value="Reset">

Please note: the information on this page applies to ITS web hosting plans. It may or may not apply to other environments. If you are looking for a feature described here, or better support from your hosting provider, please consider hosting your site with ITS!

1555 N Naperville/Wheaton Road, Suite 107
Naperville, IL 60563
phone 630.420.2550
fax 630.420.2771