formmail.pl is a Web form delivery script that can be used with any account level at pair Networks. We are using a special version of formmail.pl modified to protect against abuse by ensuring that the email recipient is legitimate.
Any form fields included in the call to formmail.pl will be included in the email that is sent.
formmail.pl has many optional hidden fields, but only the recipient field, which determines
where the email 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. Unless you are running suEXEC as well, you should not copy the formmail.pl file to your account cgi-bin unless you intend on customizing the source code of it. 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.
In the following example, only the recipient field is required. This field specifies the destination email address for the form contents. Example:
<input type=”hidden” name=”recipient” value=”firstname.lastname@example.org”>
If you wish to have multiple recipient email addresses, then separate each email address with a comma in the value section of this field.
All recipient email addresses must also be listed in a file named .formmail, placed into your account home directory (/usr/home/USERNAME). This prevents the form from being abused to send to arbitrary addresses.
If the recipient address you list on the form is not an email address on your pair Networks hosting plan, you will receive the following error message.
Error: Bad Recipient
One of the recipients of the information on this form is not a customer of pair Networks. Sorry.
Other formmail.pl Fields:
- subject – This field specifies the Subject line of the outgoing email. If not
given, the default Subject is “WWW Form Submission.”
- email – This field specifies the return email address of the user submitting
the form. If supplied, this should be a field filled in by the user.
The email will be generated so that your mailer’s reply function
should go to this email address; if not supplied, the default is email@example.com
- realname – This field specifies the real name of the user submitting the form.
If supplied, this should be a field filled in by the user. The email
will be generated with this name in the headers.
- redirect – This field specifies the URL to which the user should be automatically
redirected after successful delivery of the form. It must be a full URL; relative links will not work. If this field is not specified, a default response will be generated by the script.
- required – This field allows you to specify that certain fields (in a comma separated list) in the form are “required.” This means that these fields may not be empty when the form
is submitted. If any of the specified fields are empty, the user will
receive a warning, and the form will not be submitted.
- title – This field specifies the title for the default response page that is
generated by the script in absence of a redirect field. The default is “Thank You.”
- return_link_url – This field specifies a URL that will appear on the default response
page that is generated by the script in absence of a redirect
field. This URL can be used to allow users to return to, for example,
your home page.