Meloria • Ever Better
Search Tools Main Menu

Sending Data from Web Forms via Email

University Information Technology has a script called "formmail" to simplify the transfer of information from HTML Forms in Web pages to email. This document contains instructions on how to use this script to email form information to a target address. Do not use this method to transmit confidential or financial information. If you need to do so contact Web Services for advice on university policy regarding such information.

The current version of formmail includes anti-spam measures. Spam is defined as unwanted bulk email. These features make it very difficult for spammers to use your form to send spam. This does not protect your address from being captured by spammers. It only prevent use of the form to do it.

  • Your form must reside on a server. If you are not and are part of the University of Rochester community contact and explain your situation. Your form will not work unless it is part of our network of servers or registered with us. Any University of Rochester server is allowed to call this program.
  • Your target email address, the recipient, must be within the mail server network. If the recipient is not on a University of Rochester server contact and explain your situation. Your form will not work unless the mail recipient is part of our network of mail servers or is registered with us. Any University of Rochester mail server is allowed to receive mail from this server.

To get started, here is what you need:

  • A form page with the program call embedded in it

The form can be found below in this document, well commented with directions using html tags (i.e.<!Insert comment here>). Please read the directions carefully. There is some special notation you must follow. You would insert this form in your page along with any instructions you feel are needed.

  • Knowledge of forms html code

This is assumed below. You can find further documentation online and from many Internet references available, or any a good HTML "how to" book.

  • A response page

A sample is included below. This page is where you acknowledge the form user for sending the message and perhaps tell them when they may expect a response. You should modify it to look similar to your other pages using headers and backgrounds etc. The title and headers should relate to the use you are putting the page to. You should have at least a back button to return users to the form or some other appropriate page. This page should live in the same folder/directory as the form html page. However, as long as you specify the address correctly in the form page, it can live anywhere.

  • Optional built-in fields

There are many optional built-in fields available which suggest novel and flexible uses for your forms to email usage. We recommend that you review the options as they can make your form friendlier and open the door to a more useful utility for you and the use

  • All other fields

Any other form fields that appear in your script will be mailed to the target address and displayed on the resulting page if you do not have the redirect field set. There is no limit as to how many other form fields you can use with this form, except the limits imposed by browsers and your server. You may use any name for your fields that is not in use as a built-in or begins with an "*".

If you have any questions please contact WebHelp at

Sample HTML Form Page Code

<head><title>Put the title of you page here.</title>


<h1>Put the title of you page here.</h1>

<p>Here is where any instructions would appear as well as other needed

<! The following is the call to the CGI and must be exactly this code.

<form method=post action="">

<! All fields with * are field names reserved for the form-to-mail
program. These tags must only be used as the program intends. You cannot
change their purpose. All other field names are decided by you, the form
builder. You can add as many fields as you need as long as they are each
an unique name. Note that, for example, "*email" and "email" are distinct
field names.>

<! The value in the next line is where the mail generated by the CGI
based on the form input will be sent. PUT YOUR TARGET EMAIL ADDRESS IN

<input type=hidden name="*recipient" VALUE="">

<! You should have something in this value field to identify the
content of the email that is to be sent by the CGI.>

<input type=hidden name="*subject" VALUE="Forms to E-mail Demo">

Examples of user defined fields: <BR>

What you want: <INPUT TYPE=text NAME="want"> <BR>

What you don't want: <INPUT TYPE=text NAME="donnot"> <BR>

<!Here are some fields that ought to be required. We stipulate this


Name: <input type=text name="name"> <BR>

E-mail Address: <input type=text name=NAME="*email"> <BR>

<! Here is how you specify fields that you want to require the user to
fill out before the form will be mailed to you. This example requires the
two fields "name" and "*email" to be filled in.>

<input type=hidden name="*required" VALUE="name,*email">

<! The next line causes your "thank you" page to appear after the
message is sent. You can put whatever you wish in that file as a response
and thank you. This file should be in the same folder/directory as this

<input type=hidden name="*redirect" VALUE="/full-path-to-your-page/thanks.html">

<!NOTE: You must use the FULL path of your page. e.g. /ITS/web/thankyou.html>

<!These are the standard control buttons. You should not edit them.>

<input type=submit VALUE="Send">

<input type=reset VALUE="Clear Form">

<! Be sure to include appropriate copyright notices and last updated
date as well as any other required data here in the footer.>


Sample Response Page

<title>Thank you for your submission/mail/input/feedback etc.</title>


<h1>Thank you for your submission/mail/input/feedback etc.</h1>

<p>Here is where you put back buttons, explanations or whatever you feel is
appropriate. Be sure top include copyright and other requires components.
All URL's on this page must use the full path to the target file.
Example: "/ATS/webserv.html" If you use just "webserv.html" the program
will be unable to locate the file.</p>