Authoring/Development - formmail.pl
formmail.pl is a Web form delivery script that can be used with Basic level accounts and higher that supports a variety of options. We are using a special version of formmail.pl modified to protect against abuse by ensuring that the e-mail recipient is legitimate.
Any form fields included in the call to formmail.pl will be included in the e-mail that is sent. formmail.pl has many optional hidden fields, but only the recipient field, which determines where the e-mail is sent, is required.
formmail.pl accepts form submissions using the POST method. The line to pass the form input from your page to formmail.pl is:
<FORM METHOD="POST" ACTION="/cgi-sys/formmail.pl">There are no modifications needed to this line in your code. You should not copy the formmail.pl file to your account cgi-bin unless you intend on customizing the source code of it. This is not needed for normal usage. The "cgi-sys" portion of the ACTION above directs the server to look into the server's cgi-bin so the formmail.pl script doesn't need to reside in your individual account.
For an example of a typical formmail Web form, click here. When viewing the page, right-click your mouse and "View Page Source" for the notes and HTML source code.
In the following example, only the recipient field is required.
<INPUT TYPE="hidden" NAME="recipient" VALUE="address@example.com">
If you wish to have multiple recipient e-mail addresses, then separate each e-mail address with a comma in the "VALUE" section of this field.
If the recipient address you list on the form is not an e-mail address on your pair Networks hosting plan, you will receive the following error message:
Error: Bad RecipientIf you wish to authorize the external e-mail address to be able to receive the form submissions, you will need to add the e-mail address to a file called .formmail. This file needs to be placed into your home directory on the server:
One of the recipients of the information on this form is not a customer of pair Networks. Sorry.
/usr/home/USERNAMEReplace USERNAME with your pair Networks account username. This file is a plain text file. You can list multiple external e-mail addresses in it. Each e-mail address should be placed on its own line.
NOTE: If you are using the server hostname (i.e. http://www.pair.com/username/) instead of using a domain name in your account to access formmail.pl, and you would like to use the .formmail file to specify recipients, you must include your username via the username field described below.
<INPUT TYPE="hidden" NAME="username" VALUE="yourname">
Additional Formmail.pl Fields
The fields below can be used when creating Web forms.
<INPUT TYPE="hidden" NAME="subject" VALUE="Some Subject Line">You can also allow the user to specify the Subject field:
<INPUT TYPE="text" NAME="subject">
<INPUT TYPE="text" NAME="email">
<INPUT TYPE="text" NAME="realname">
<INPUT TYPE="hidden" NAME="redirect" VALUE="http://example.com/whatever.html">
<INPUT TYPE="hidden" NAME="required" VALUE="email,subject">
- REMOTE_ADDR - IP address of the user's host
- HTTP_USER_AGENT - name and version of the user's Web browser
Example:
<INPUT TYPE="hidden" NAME="env_report" VALUE="REMOTE_HOST,HTTP_USER_AGENT">
<INPUT TYPE="hidden" NAME="sort" VALUE="alphabetic">
<INPUT TYPE="hidden" NAME="sort" VALUE="order:name,email,phone">
<INPUT TYPE="hidden" NAME="print_config" VALUE="email,subject">
<INPUT TYPE="hidden" NAME="print_blank_fields" VALUE="1">
<INPUT TYPE="hidden" NAME="title" VALUE="Form Results">
<INPUT TYPE="hidden" NAME="return_link_url" VALUE="http://example.com/">
<INPUT TYPE="hidden" NAME="return_link_title" VALUE="Return to Home Page">
<INPUT TYPE="hidden" NAME="background" VALUE="http://example.com/img/bkgr.gif">
<INPUT TYPE="hidden" NAME="bgcolor" VALUE="#FFFFFF">
<INPUT TYPE="hidden" NAME="text_color" VALUE="#000000">
<INPUT TYPE="hidden" NAME="link_color" VALUE="#FF0000">
<INPUT TYPE="hidden" NAME="vlink_color" VALUE="#0000FF">
<INPUT TYPE="hidden" NAME="alink_color" VALUE="#00FF00">This script can also be referenced as FormMail.pl.
NOTE: As the original version of this script has had a spotty security history, we are using a heavily customized version. If you plan to customize formmail.pl for your own use, we strongly suggest you start either with our version (which can be copied from /usr/www/cgi-bin/formmail.pl), or the version made available by the NMS Project.





