How To Make an Auto Email Form

By Graham Worrall, CISC474, 06S

  1. Make a form that you want submitted to someone via email. Make sure all fields have names that make sense because these names will be used later.
  2. This form must also have a field for the person's email who it is to be sent from. This field's name has to be "replyto".
  3. In the form tag add the following as the action: "action="http://chico.nss.udel.edu/mailto/mailto""
  4. At the end of the form add the following fields. These are hidden fields so they will not show up on the form when people view it:

    <input type="hidden" name="mailformat" value="text" />
    <input type="hidden" name="html_source" value="(url of format file)" />
    <input type="hidden" name="returnpage" value="(url of completion page)" />
    <input type="hidden" name="subject" value="(Subject Line of Email) " maxlength="1024" />
    <input type="hidden" name="suppress" value="mailto returnpage serverinfo answer" />
    <input type="hidden" name="mailto" value="(Email address the email is to be sent to) " />

    The previous urls are full urls not just the relative path.
  5. Now in a separate HTML file you have to make the completion page that is referenced in the line above whose name is "returnpage".
  6. This page can say anything you wish. This is the page that the people are forwarded to after the form is submitted.
  7. In another separate HTML file you have to make the format page that is referenced in the line above whose name is "html_source".
  8. This is the file that tells the program how to format the email that gets sent. This file should be formatted as another form so that text fields and text areas can be included. All that needs to be done when you want a text field from the original form is add a text field to the "html_source" file with the same name as in the original form. When the email gets sent, this field will be populated with the data submitted by the text field.
  9. If you are using a text area then just add a text area to the "html_source" file. But if you are using a pull down menu, in the "html_source" file you make this a normal text field with the name of the pull down menu and it will work correctly.

    For an example of all of this here is my group's Evaluation Form which implements this system. There is also a link to the code from the form with the parts that are important to the email system highlighted.

    Highlighted - Form - html_source - returnpage

 

Regular Expression Info

Regular expressions are very helpful in many ways including form validation, search and replace, and so on. The following site comes in very handy when trying to make a complicated regular expression. It allows you to input the regular expression and 4 test strings. It will then highlight the test strings that match the regular expression and leave the ones that do not white. This way you do not have to implement the regular expression every time you change it a little.

Regular Expression Tester


Valid XHTML 1.1