em -- email example for form-submit


This is an example of the use of MV Communications's form-submit utilty to process an HTML form and have the results sent by email.

Note that this information represents examples only, and any HTML and other data here may be skeletal; e.g. to the HTML given here you might want to add icons and colors, and flesh out the structure of the document.

This example uses the "email-to" function of form-submit, which causes form results to be emailed to a specific email address, using a template file as a model for the message. Here, it's assumed that this form is being used by J. Random User, who has a Web page at http://www.mv.com/ipusers/jruser and an email user of jr@jruser.mv.com . J. Random has created a directory forms for various forms, including this one; and in this directory there are the following files that make this particular form work:

em.html -- the HTML form

This is the form that the submitter fills in; submitting this form causes form-submit to email a message based on the information filled in here. This form asks for the submitter's name, email address, and some comments.

    <title> Send me some comments </title>
    <CENTER><B><I>Your comments?</I></B></CENTER>
    By filling out this small form you can send me some comments.
    <form ACTION="/cgi-bin/form-submit/ipusers/jruser/forms/em" method="post"> 
    Your name:<br>
    <input name="name" type="text" size=60> <br>
    Your email address:<br>
    <input name="email" type="text" size=60> <br>
    Your comments?<br>
    <textarea name="comments" COLS=60 ROWS=8></textarea><br>
    <input type="submit" value="Send">
    <input type="reset" value="Clear"> 

The most important line is the reference to the form-submit utility:

    <form ACTION="/cgi-bin/form-submit/ipusers/jruser/forms/em" method="post"> 

Here, the argument /ipusers/jrusers/forms gives the path from the top of the WWW tree to J. Random's forms directory, and the final element em identifies the form to be used. Given this, form-submit will take its directions from a file named em.submit in that forms directory.

em.submit -- the definitions file for form-submit

The em.submit file tells form-submit how to proceed with processing the form submitted from em.html .

    # submit file for email form
    Tag-Required:	name
    Tag-Default	comments	""
    Email-file	em.template
    Email-to	jr@jruser.mv.com
    Return-document:	em-done.html

This file says that the submitter's name must be provided, and that the comments field, if omitted, will be set to blanks -- this will make sure that there is a translation for the comments field when it is included in the email message. The file also specifies that the results of the form should be emailed to jr@jruser.mv.com using the file em.template as a model. That file (the template file) contains form-submit style substitutions so that the actual submitted information can be sent in the desired format. Finally, the em.submit file says that when the form is successfully processed, a file em-done.html should be returned to the submitter as a confirmation page.

em.template -- a template for the email message

The em.template file is identified in the em.submit control file as the file that will be sent as email each time a submission is made. This template file has the appropriate forms-submit substitution strings so that the input data can be included in the email message.

    Subject: Comments from EM form
    Comments from:  ~name
    ~?~:email==yes ~{-
    Email:          ~email

Note that the first line of this template file can provide part of the email header; in this case the Subject: line is provided. A blank line should follow any header text provided.
The sequence:

    ~?~:email==yes ~{-
    Email:          ~email

makes sure that the submitter's email address is included in the email message only if there was one provided. Note the use of the continuation characters to suppress extraneous blank lines.

em-done.html -- the confirmation file returned to the submitter

This is simply a page that is returned to the submitter after the form has been processed.

    <h3>Thank You</h3> <p> 
    Your comments have been received.
    Please use your "back" function to return.