Documentation - Web Tools
Generic E-mail Form
This form will collect information entered into a form and then email it to a person of your choosing. Note: this script is for use on basic forms collecting simple information only. It is not appropriate for complex forms and should not be used for collecting sensitive data. Questions about whether this script is appropriate for your project? Contact Web Services.
You can see this form in action: http://smartmuseum.uchicago.edu/contact/.
Creating the basic Generic E-mail Form
- Create your form with the fields that you need. Your <form> tag should look like this:
<form method="post" action="http://www.uchicago.edu/cgi-bin/genemail.cgi">
- Add the following code should below the <form> tag. You will want to modify the email and URL information.
<input type="hidden" name="to" value="username@uchicago.edu">
<input type="hidden" name="what" value="mail"> - Choose how you want the mail to be formatted. You have two choices:
Variable/Value Pairs:
<input type="hidden" name="format" value="namevarpair">
Tab Delimited File:
<input type="hidden" name="format" value="delimfile">
<input type="hidden" name="delim" value="tab">
Optional Fields for your Form
Confirmation-Page Related Fields
There is a default confirmation page. If you wish to change the text of the confirmation page, please use the following line (the value should equal whatever you want the confirmation page to say. Without this tag, none of the other confirmation page options will work.
<input type="hidden" name="confirm" value="Thank you for submitting your information. You will be redirected to the home page shortly.">
If you want an <address> to be listed at the bottom of the confirmation page, please use the following line (change the value appropriately):
<input type="hidden" name="htmladdr" value="username@uchicago.edu">
If a small amount of text for your confirmation page isn't enough, and you want a more highly customized confirmation page, please include the following line (changing "www.yoursite.edu" appropriately):
<input type="hidden" name="conf_redirect" value="http://www.yoursite.edu">
To include a custom title tag in your confirmation page, please include the following line (changing the value appropriately):
<input type="hidden" name="conftitle" value="Thanks for submitting the form">
If you have kept the default confirmation page info, but do not really want to see the variable name/variable value pairs again, use this line:
<input type="hidden" name="suppress_fields" value="on">
Email Related Fields
If you wish to change the subject line of the email that will be produced, please include the following line (changing the value appropriately):
<input type="hidden" name="subject" value="email subject line">
To change the user that the email appears to be sent from, please include the following line (changing the value appropriately. NOTE: This must be a valid email address):
<input type="hidden" name="email" value="username@uchicago.edu">
To carbon another user on the email that gets produced, please include the following line (modifying the value appropriately). If you'd like to carbon copy multiple users, simply separate the names with commas. You may include up to five addresses in this space:
<input type="hidden" name="carbon" value="username@uchicago.edu,username2@uchicago.edu">
If you wish to suppress the standard information about the client that ordinarily gets printed in the email, please include the following line:
<input type="hidden" name="suppress_info" value="on">
Miscellaneous Options and Information
You will find it helpful if you include numbers in your form field names. This will control the order of the fields when they are received in email form.
For example:.
<input type="text" name="1Name:" size="40">
<input type="text" name="2Email address:" size="30">
<input type="text" name="3Phone number:">
In the email received, the information would be arranged with the name first, the email address second, and the phone number third because of the numbers included at the beginning of the name.
If your form has "mandatory" fields, then please include the following line (modifying the value appropriately):
<input type="hidden" name="required_fields" value="1name,2name,3name">
You may find it helpful, especially if the form will eventually be directed to someone else, to test it by putting in your own email address.
Back to Web Tools Home
Last updated: 5/27/09