Using Mail to Form

Using a MailTo Form at BSC

For the convenience of the Bridgewater State College community, Information Technology is providing a generic cgi program that can be used with all forms running on the BSC web server (www.bridgew.edu). This program, when included correctly into your form's code, will generate an email message notifying you of the results of a form submission.

How this works:

  1. Determine who in your department should be receiving the email results.
  2. Follow the template provided below to create your form. The fields listed below as BSC Specific must be provided for the form to work correctly.
  3. Line 1 should be placed in your form code with NO CHANGES.
  4. In Line 2, replace From 4 above with the username of the person to receive the mail. (This must be in the form jdoe@bridgew.edu) If you are sending to multiple recipients, use a comma as a delimiter - no space after the commas (jdoe@bridgew.edu,sdoe@bridgew.edu)
  5. In Line 3, put the value that will become the "subject" line of the email message you receive. This should be something that will let you know that you are receiving a form submission. For instance "Results of Test Form"
  6. In Line 4, replace Thank you message with your own thank you message that will be displayed after the user submits the form.
  7. In Line 5, replace URL with the url of the page you wish to return people to after they have completed submitting your form. The URL may be either the fully qualified URL as in http://www.bridgew.edu/ or it may be a relative URL as in /
  8. In Line 6, replace Title with the title of the page you specified in Line 6
  9. NOTE: Please do not name fields with a trailing _DATE, _TIME, _FLOAT, _INTEGER, or _RANGE as these are ColdFusion validation operators. Using fields with this syntax will cause your form to be processed incorrectly.

Standard>  <html>
Standard>  <head>
Standard>  <center><title>Your Title Here</title></center>
Standard>  </head>
Standard>  <body>

  
Start of BSC Specific
Please note that the order of these BSC specific entries is important. If the order is changed, the script will not work correctly.
Line 1>  <form action="http://www.bridgew.edu/services/mailto/Mailto.cfm" method="POST">
Line 2>  <input type=hidden name="to" value="From 4 above">
Line 3>  <input type=hidden name="subj" value="From 5 above">
Line 4>  <input type=hidden name="thank_you" value="Thank you message">
Line 5>  <input type=hidden name="back_url" value="URL">
Line 6>  <input type=hidden name="backpage" value="Title">
End of BSC Specific

  
Sample Form Code
<table width=100%>
     <tr>
          <td>Name:</td>
          <td><input type="text" size="50" name="Name"></td>
     </tr>
     <tr>     
          <td>No. and Street: </td>
          <td><input type="text" size="50" name="Address"></td>
     </tr>
     <tr>
          <td>City and State:</td>
          <td><input type="text" size="50" name="City_State"></td>
     </tr>
     <tr>
          <td>Zip Code:</td>
          <td><input type="text" size="50" name="Zip"></td>
     </tr>
     <tr>
          <td>Phone No.:</td>
          <td><input type="text" size="50" name="Phone"></td>
     </tr>
     <tr>
          <td>Extension:</td>
          <td><input type="text" size="50" name="Extension"></td>
     </tr>
     <tr>
          <td>Username:</td>
          <td><input type="text" size="50" name="Username"></td>
     </tr>
</table>
End of Sample Form Code

  
Standard>       <input type="submit" value="Submit">
Standard>       <input type="reset" value="Clear Form">
Standard>       </form>
Standard>       </body>
Standard>       </html>


What has changed
  1. You no longer need the "num" field that specified how many fields you were using
  2. Order of the BSC fields is no longer important. It will be easier for you to modify the code if you keep the hidden fields together, but the actual order of the fields is not important.
  3. The results returned to the user will be different and will be framed by the BSC template page.
  4. The URL for the form submission page has changed. Instead of <form action="http://topcat.bridgew.edu/scripts/mail.com" method="POST"> you will put <form action="http://www.bridgew.edu/services/mailto/Mailto.cfm" method="POST">
  5. You may no longer use commas in field names. For instance, <input type=text size=50 name="City, State"> should be changed to <input type=text size=50 name="City State"> or <input type=text size=50 name="City_State"> to eliminate commas.
  6. You may no longer use commas in option values. For instance, <input type=radio name="date_preferred" value="Oct. 18, 19, 20"> should be changed to <input type=radio name="date_preferred" value="Oct. 18 19 20"> or <input type=radio name="date_preferred" value="Oct. 18-20"> to eliminate commas.

Click HERE to see what this would look like.

Last Modified: May 7, 2008