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.
To get started, here is what you need:
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.
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.
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
If you have any questions please contact WebHelp at .
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 "*".
<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.
DO NOT EDIT THE CONTENT OF THIS TAG!>
<form method=post action="http://www.rochester.edu/ur-php-bin/formmail.php">
<! 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
<! The value in the next line is where the mail generated by
based on the form input will be sent. PUT YOUR TARGET EMAIL ADDRESS IN
PLACE OF email@example.com>
<input type=hidden name="*recipient" VALUE="firstname.lastname@example.org">
<! You should have something in this value field to identify
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
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
page. YOU MUST EDIT THE PATH PART OF THE NEXT LINE TO MATCH THE ACTUAL
LOCATION OF THE RESPONSE PAGE.>
<input type=hidden name="*redirect" VALUE="/full-path-to-your-page/thanks.html">
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
<input type=submit VALUE="Send">
<input type=reset VALUE="Clear Form">
<! Be sure to include appropriate copyright notices and last
date as well as any other required data here in the footer.>
<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>