Web Communications

You are here


FormMail is a form-to-email script that offers such advanced features as required fields, URL redirection, and more. For details about using FormMail and its available options, follow the instructions below.

STEP 1: Setting up Your Form

  1. Create a form using Dreamweaver or a similar web authoring application.
  2. Find the opening <form> tag and replace it with the following lines of code. Be sure to fill in your own information as indicated below.

<form method="post" action="http://web.unlv.edu/cgiwrap/webcgi/formmail/FormMail.pl">
<input type="hidden" name="recipient" value="Insert your email address here. Multiple addresses may also be used; separate them with a comma (no space)." />
<input name="subject" value="Insert the text you wish to use for the email subject line here" type="hidden" />
<input name="sort" type="hidden" value="order:Insert the input names here;separate them with a comma (no space). See sort entry below for more information." />

Insert your form here.

  1. Publish your form to the server.
  2. Open your web browser and test your form. You should see a thank you page after clicking the "Submit" button.
  3. Customize your form using the tags described in Step 2 below.
Note About Special Input Tags

The following nonhidden input tags are reserved and given special treatment by FormMail.

email — If the user is prompted to fill in an email address and you call that input 'email' (no hypen), FormMail will use it as the sender's address in the email sent by FormMail.

realname — If the user is prompted to fill in his/her full name and you call that input 'realname,' FormMail will use it as the name of the sender in the email sent by FormMail.


STEP 2: Advanced Options Using Hidden Input Tags

Several options are available with FormMail. To take advantage of these features, insert the appropriate hidden input tag(s) into your form.

recipient — The email address to which the form submission should be sent. NOTE: A valid UNLV email address is required. If you would like it copied to more than one recipient, separate multiple email addresses with commas. For example:

<input type="hidden" name="recipient" value="[email protected],[email protected]" />

subject — The subject line for the email. For example:

<input type="hidden" name="subject" value="Membership Application Submission" />

redirect — Use this option to redirect the user to another URL after a successful form submission. For example:

<input type="hidden" name="redirect" value="http://web.unlv.edu/yourpage.html" />

If you don't specify a redirect URL, FormMail will generate a thank you page telling the user that their submission was successful.

text_color — The text color for the success page.

link_color — The link color for the success page.

vlink_color — The vlink color for the success page.

alink_color — The alink color for the success page.

title — The title for the success page.

return_link_url — The target URL for a link at the end of the success page. This is normally used to provide a link from the success page back to your main page or back to the page with the form. For example:

<input type="hidden" name="return_link_url" value="/home.html" />

return_link_title — The label for the return link. For example:

<input type="hidden" name="return_link_title" value="Back to my homepage" />

sort — This sets the order in which the submitted form inputs will appear in the email and on the success page. It can be the string "alphabetic" for alphabetic order or the string "order:" followed by a comma-separated list of the input names. For example:

<input type="hidden" name="sort" value="order:name,email,age,comments" />

If "order:" is used, you must supply the names of all of the fields that you want to be in the body of the mail message.

print_config — This is mainly used for debugging. If set, it causes FormMail to include a dump of the specified configuration settings in the email. For example:

<input type="hidden" name="print_config" value="title,sort" />

The above example will include whatever values you set for "title" and "sort" (if any) in the email.

required — This is a list of fields that the user must fill in before submitting the form. If they leave any of these fields blank, then they will be sent back to the form to try again. For example:

<input type="hidden" name="required" value="name,comments" />

missing_fields_redirect — Set this value to a URL, and the user will be redirected to the specified web address if any of the fields listed in "required" are left blank. Use this option if you want finer control over the error that the user sees if they miss a required field.

env_report — This is a list of the CGI environment variables that should be included in the email. This is useful for recording things like the IP address of the user in the email.

print_blank_fields — Set this option to include blank fields in the email. Normally, blank fields are suppressed to save space.

Produced by UNLV Web Communications | © 2015 University of Nevada, Las Vegas Website Feedback