Creating an E-mail Form

From Math
Jump to: navigation, search

Creating an E-mail Form

To create an e-mail form, simply use a text editor to create a web page in your space on the Math Department web server. The form must be in your space on the Math Department web server. The process will not work from outside the department. Create a form on the page with the action attribute of the form tag set to https://www.math.wisc.edu/formMail/formMail.php. You can have any number of fields on the form however certain fields have special meaning. The following form fields are required:

recipient This field is used to specify the recipient of the e-mail message. normally, this would be your e-mail address. The address must be a valid Math Department e-mail address. You cannot use this service to send e-mail to addresses outside the Math Department. You can have the message sent to more than one address by listing the addresses separated with commas. Example:

<INPUT name="recipient" type="hidden" value="jheim@math.wisc.edu">

subject The message subject. You will probably want to set this to something distinctive so that you can filter your mail based on the subject. Example:

<INPUT name="subject" type="hidden" value="Conference registration">

email This field is the sender's e-mail address. The message will appear to have come from this address. Example:

<INPUT name="email" type="text">


The following fields are optional:

realname This field is used to allow the user to enter his real name. Example:

 <INPUT name="realname" type="text">
 

required This field allows you to specify that certain fields are filled out when the form is submitted. If a visitor to your site clicks the submit button without filling out a field, an error message is displayed and he is asked to return to the form to fill out the field. Example:

 <INPUT name="required" type="hidden" value="realname">

sort This field is used to allow for a custom sort order of the form fields. The syntax is each field name separated by commas. If you omit a field name in the list, but it's a valid form field, the field will NOT be shown in the email. env_report This field is used to specify that you wish to receive additional environment settings to be included in the form results. Valid values are REMOTE_USER, REMOTE_ADDR, and HTTP_USER_AGENT. These values should be separated by commas. REMOTE_USER: If the user is in an authenticated zone of your site, this would be the username they are logged in with. REMOTE_ADDR: This is the IP address of the users computer. HTTP_USER_AGENT: This is the user agent field as set by the users browser, which typically has the browser type in it.

Example:

               <INPUT name="env_report" type="hidden" value="REMOTE_ADDR,HTTP_USER_AGENT">
               

redirect This field is used to specify which URL you wish to be displayed to the user upon a successful form submission . This can be a relative or absolute pat. There is a default Thank You page built in. error_redirect This field is used to specify which URL you wish to be displayed to the user upon encountering an error. This does not include missing fields, but rather just errors with field data and errors pertaining to submitting the form. This can be a relative or absolute path . there is a default Error page built in. missing_fields_redirect This field is used to specify what URL you wish to be displayed to the user upon encountering a missing field. This can be a relative or absolute path . there is a default missing field Error page built in. >


Complete example:

<FORM action="https://www.math.wisc.edu/formMail/formMail.php" method="POST"> <INPUT name="recipient" type="hidden" value="jheim@math.wisc.edu">

<INPUT name="subject" type="hidden" value="Computing Feedback">
 <INPUT name="env_report" type="hidden" value="REMOTE_ADDR,HTTP_USER_AGENT">

Your email: <INPUT name="email" type="text">

Your name:

 <INPUT name="realname" type="text">
 
 Your comments:
 <TEXTAREA name="comments"> </TEXTAREA>
 
 <INPUT type="submit" value="Submit">
 </FORM>