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
- Create a form using Dreamweaver or similar web authoring application.
- Find the opening <form> tag and replace it with the following lines of code. Be sure to replace the text shown in red with your own information.
<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.
- Publish your form to the server.
- Open your web browser and test your form. You should see a thank you page after clicking the "Submit" button.
- Customize your form using the tags described in Step 2 below.
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@example.com,firstname.lastname@example.org" />
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.