cgi-this home
    


Resume

Projects

......

....

..
This CGI script takes input from a web form and e-mails it to the desired address. It takes several options but the only required input field is the recipient. If the web form you are referencing this script from has a standard URL (http://...) then you should use a standard URL for the script. If the web form you are referencing this script from has a secure URL (https://...) then you will need to use a secure URL for the formmail script. You will run into problems errors if you do not follow this guideline.

Each of the script's options is described below and should be specified in your HTML code like this:
<input type="hidden" name="option" value="value">

Options

  • FROM
    This input field designates the "From:" header in the e-mail message that the script sends. The default value is formmail@omsoft.com. Important: This field must contain a valid e-mail address. Typos or mistakes in this field can lead to lost mail. Some mail servers will reject messages with malformed "From:" headers. Also, you will not receive bounce messages and you will never know you lost them.
  • RECIPIENT
    Required. This field indicates who to send the e-mail message to. You may send to multiple recipients by separating e-mail addresses with commas within this field.
  • REDIRECT
    This is the URL (such as http://www.omsoft.com/) to redirect the web browser to once the form has been submitted. If this field is not used, the script will display a summary of what the visitor submitted and who they submitted it to.
  • REQUIRED
    This is a comma-separated list of input fields that you wish the visitor to fill out before submitting the form.
  • SORT
    This option allows you to specify the order that the data is presented in the e-mail message. List the names of the fields you want in the order you want them, separated by commas.
  • SUBJECT
    This option specifies the subject of the e-mail message sent by the form mailer. The default value is Form Data.


Example

Below is an example of a simple HTML form that uses the formmail script. Input values in bold indicate information that you should change to fit your needs.
Here is the HTML code for the form:

<form name="formname" action="http://www.omsoft.com/cgi-bin/formmail.pl" METHOD="POST">
<input type="hidden" name="RECIPIENT" value="formhandler@yourdomain.ext">
<input type="hidden" name="SUBJECT" value="Form data submission">
<input type="hidden" name="FROM" value="webform@domain.ext">
What is your name? <input type="text" name="NAME" value="">
What is your favorite color? <input type="text" name="FAVORITECOLOR" value=""> <br>
<input type="submit"> <input type="reset"> </form>
<br>


And here is what the form will look like on a web page:

What is your name?
What is your favorite color?

The form asks for the name and favorite color of the visitor. If a visitor types in "George" for the name, "Green" for the favorite color, and submits the form, formhandler@yourdomain.ext will recieve an e-mail message that looks something like this:
From: webform@domain.ext
To: formhandler@yourdomain.ext
Subject: Form data submission

IP Address: xxx.xxx.xxx.xxx
NAME: George
FAVORITECOLOR: Green
The IP Address is the internet identity of the person who submitted data via the form. It is included in all submissions by default.