OIT Tech 32px
pagemasters' toolbox -- static pages

Using our Generic Mailto Script

 

Appendix V Table of Contents

 

 

A. Introduction

B. MAILER Mailto Form

 


 

A. Introduction

 

This Appendix discusses a generic script provided by the Office of Information Technology for use by Ohio University web authors to transcribe information from an online HTML form and send it to a designated e-mail address. We reserve the right to modify the code at any time, without notice, including specifically modifications to restrict it to working only when the web page the form is on is an Ohio University web page, or only when the e-mail address the information is sent to is an Ohio University address.

We retain a partial discussion of three obsolete predecessor scripts ("OUVAXA," "ILIAD," and "ADMSRV"), because they used to work, but all new forms should be done using the new script ("MAILER"), and all pages using any of the old scripts should be updated immediately: the first two of those old scripts no longer work, and the last one will soon also be permanently retired.

These Mailto scripts take information provided by your reader through an HTML "form," transcribe that information into an e-mail, and send that e-mail to the address of your choice. The E-mail message will travel to the address you have specified as clear text, not encrypted, but by then will be anonymous, unless your reader has provided identifying information.

Even if the page your form is on and the script are both accessed through secure ("https://") addresses, it is essential that your form should not request any sensitive information, such as Social Security or credit card numbers, both because the e-mail will be travelling through the internet without encryption, and also because the information will be stored for uncontrolled periods of time on intervening mail servers, available to be read by any of the system administrators.

If your form includes any free-entry text fields (that is, input data fields of type TEXT or TEXTAREA; input data fields of type SELECT, RADIO, or CHECKBOX are not free-entry fields, because they constrain the possible responses), then you should include visible text on the page, warning that the information will not travel securely, so that people will know not to include sensitive information in what they type.

If you want to make arrangements to send information to multiple people at once, see also the page about Listserv creation.

When you work on your Web page, saving revised versions to your hard disk, you may well find that your browser "reloads" the old form, not reflecting the changes you just saved. If this happens, use the browser's back button to return to the directory listing, and then click on the filename again. This will cause your browser to re-read the file from the disk.

 

B. Collecting Information with MAILER Mailto Forms

 

This section describes the use of forms with a generic script that permits all web authors within Ohio University to gather basic information, even in situations where your reader is using a browser that is not configured for E-mail (e.g., a public, "kiosk" installation).

 

This generic script has been designed to facilitate updating of forms previously using the now-retired OUVAXA script, or previously using the now-retired ILIAD script, or previously using the soon-to-be-retired ADMSRV script. It will be enhanced to facilitate the use of data-validation tools.

 

Restrictions

 

This form may not work from your hard disk, nor from any server outside of the main Ohio University network (IP numbers 132.235.*.*). If you are using the Front Door server, you can test your new or revised form using the staging server, as discussed previously.

 

You must name your data fields as described below.

 

Special Considerations for CommonSpot Pages

 

Because of the interactions between form fields and the internal coding of the Rich Text Editor, you cannot reliably create and maintain forms using the HTML view of the RTE. Instead, use the HTML Fragment element.

 

 

Known Issues

 

[None at this time.]

 

 

Required Functional Fields

 

There are just three required tags:

 

  1. <FORM ACTION="http://www.ohio.edu/mailer/index.cfm" METHOD="POST" ENCTYPE="multipart/form-data">

    The FORM tag must be as shown above, except that the last attribute and value (ENCTYPE="multipart/form-data") may be omitted if you do not want to provide your user with the opportunity to upload a file that will arrive as an attachment to the E-mail message. In particular, the "/index.cfm" at the end of the ACTION attribute is required for correct operation.

    The E-mail message will travel to the address you have specified as clear text, not encrypted, but will be anonymous, unless the user provides identifying information.

    The following alternative versions of the FORM tag were previously used with the ADMSRV, ILIAD, and OUVAXA scripts, respectively. They, and any other form tags whose ACTION attribute has a value specifying anything on ADMSRV, OUVAXA, or ILIAD, are obsolete and should be replaced immediately with the MAILER version given first, above:

    • <FORM ACTION="http://mailer.admsrv.ohio.edu/mailer/" METHOD="POST" ENCTYPE="multipart/form-data">

    • <FORM ACTION="http://iliad.cats.ohiou.edu/cgi-cf/public/formmail/mailer.cfm" METHOD="POST">

    • <FORM ACTION="http://ouvaxa.cats.ohiou.edu/htbin/genform.com" METHOD="GET">

    These obsolete versions no longer work; they did not support all of the optional functional fields described below; and the second and third each supported only one of the alternatives for the next required field.

  2. One of the following two alternatives:

    • <INPUT TYPE="Hidden" NAME="Email_To" VALUE="email address you want the form to go to">

      or

    • <INPUT TYPE="Hidden" NAME="mailto" VALUE="email address you want the form to go to">

    This can be a visible field that the user types into, with TYPE="Text" instead of TYPE="Hidden"; it can also be a "SELECT" pop-up; the value must be:

    • a single validly formatted e-mail address, or

    • two or more validly formatted e-mail addresses, in a comma-separated list, with no embedded space characters.

    This tag must occur between the first and third required tags; it can occur at any place between them, but debugging will be easier if you place it near one of the other two.

  3. </FORM>

 

Optional Functional Fields

 

There are also several optional functional fields:

 

  1. <INPUT TYPE="Hidden" NAME="Email_From" VALUE="email address you want to have the email appear to be from">

    This also can be either a hidden tag; a text box the user populates; or a SELECT pop-up. If you do not specify this field, or the user leaves it blank, then the e-mail will appear to have come from "email.transcriber@ohio.edu" rather than from any real person.

  2. One of the following two alternatives:

    • <INPUT TYPE="Hidden" NAME="Subject" VALUE="the subject of your form">

      or

    • <INPUT TYPE="Hidden" NAME="subject" VALUE="the subject of your form">

    This also can be either a hidden tag; a text box the user populates; or a SELECT pop-up. If you do not specify this field, or the user leaves it blank, then the e-mail will have a subject of "Web Form Information."

  3. One of the following two alternatives:

    • <INPUT TYPE="Hidden" NAME="Redirect" VALUE="URL to be directed to when form is submitted">

    • <INPUT TYPE="Hidden" NAME="nexturl" VALUE="URL to be directed to when form is submitted">

    The Redirect can be to a thank you or a success page that you generate, but must be a complete URL, for example: "http://www.ohio.edu/". If not present, the result of submitting the form will be a dead-end page, with no links.

  4. <INPUT TYPE="Hidden" NAME="show_email_from">

    If present, places the email from value in the message body text of the e-mail.

  5. <INPUT TYPE="Hidden" NAME="show_subject">

    If present, places the subject both in the email subject and in the message body text of the e-mail.

  6. <input type="hidden" name="blank_lines_N" value="2">

    If present, places blank lines in the e-mail body text at the point in the processing where the tag occurs. The "N" part must be different for every instance of this tag in the form (consecutive numbers work just fine, but no spaces or punctuation marks aside from the underscores). The value is the number of blank lines that will be deposited. This permits some control of the formatting of the e-mail body text (comparable to what the old OUVAXA script used to provide by skipping numbers in the field names).

  7. <INPUT TYPE="Hidden" NAME="Review" VALUE="Yes">

    If you want your user to be able to review the info he or she has provided, before submitting it, then insert this as a hidden tag and give it a value of "Yes". This will create a page where the user's information displayed; if it is correct, then he or she can click a "finish" button to submit the information for e-mail processing.

  8. <INPUT TYPE="Hidden" NAME="Logo" VALUE="http://www.ohiou.edu/www/ougifs/pawtinyt.gif">

    If you have a logo or graphic you wish to be used on the review page, put the complete URL to the image in this hidden form field.

  9. <INPUT TYPE="Hidden" NAME="summary">

    If present, sends the user to a summary page after the email is sent. If summary is used in conjunction with redirect or nexturl, the user is given a button on the summary page that will take them to the redirect or nexturl destination.

  10. <INPUT TYPE="Hidden" NAME="separator" VALUE="=">

    If present, the value character will be used in the e-mail transcribing the submission to separate the form field names and the submitted values. The default is a colon; the permitted values are:

    :

    ;

    -

    =

    /

    \

    ^

    &

    ~

    [This feature was added in November, 2012.]

  11. <INPUT TYPE="hidden" NAME="showlabels" VALUE="YES">


    The value of "YES" is the default; the only alternative is "NO," which suppresses the field name labels in the e-mail.

    [This feature was added in February, 2013.]

  12. <INPUT TYPE="hidden" NAME="sendashtml" VALUE="NO">


    The value of "NO" is the default, generating a plain text e-mail; the only alternative is "YES," which generates an HTML-formatted e-mail.

    [This feature was added in February, 2013.]

 

Data Fields

 

Requirements

 

 

You can email any number of fields, named whatever you want, provided that the name:

 

  • contains no spaces;

  • starts with a letter; and

  • contains only letters, digits, or underscores.

 

Not Acceptable

 

<INPUT TYPE="Hidden" NAME="First Name" VALUE="">

 

 

Acceptable

 

<INPUT TYPE="Hidden" NAME="First_Name" VALUE="">

 

<INPUT TYPE="Hidden" NAME="FirstName" VALUE="">

 

Display in E-mail

 

The two acceptable field examples above would look like this in the email messages (assuming that the user typed in "David") respectively:

 

*First_Name:  David

or

*FirstName:  David

 

Types of Data Fields

 

Data fields used with the MAILER mailto script may include any of the data field types shown in the example, below (text, radio, checkbox, select), including the "textarea" field, which creates a scrolling and wrapping block for extended text entry. The "textarea" field type was available with the old ILIAD and ADMSRV scripts, but not with the old OUVAXA script.

 

 

Uploading One File to Send as an Attachment

 

You can have your user upload one file with the form, which will arrive as an attachment to the e-mail message. In order to do this, you must:

 

  1. Include within the FORM tag the otherwise optional attribute shown here:

    ENCTYPE="multipart/form-data"

    This attribute must be inside the FORM tag, exactly as shown here and in the discussion of the first required tag, above; it must not be modified.

  2. You must add a data field for the user to specify the file:

    <INPUT TYPE="file" NAME="attachment" SIZE="40">

    In the tag above, the TYPE and NAME values must be specified exactly as shown, only the SIZE attribute value may be modified.

  3. Do not attempt to combine this single-file method with the multiple-file method documented in the next section. Your reader will think it worked, but only some of the files will be attached to the resulting e-mail.

 

Uploading Multiple Files to Send as Attachments

 

This feature added March 27, 2009

 

You can have your user upload multiple files with the form, so that they will arrive as separate attachments to one e-mail message. In order to do this, you must:

  1. Include within the FORM tag the otherwise optional attribute shown here:

    ENCTYPE="multipart/form-data"

    This attribute must be inside the FORM tag, exactly as shown here and in the discussion of the first required tag, above; it must not be modified.

  2. You must add a hidden data field, somewhere between the FORM and /FORM tags, to specify the number of files:

    <INPUT TYPE="hidden" name="attachnum" value="3">

    In the tag above, the TYPE and NAME values must be specified exactly as shown, and the numerical value must match the number of files to be attached.

  3. You must add data fields for the user to specify the files, equal in number to the value given for the "attachnum" field, and placed in the HTML file somewhere between the FORM and /FORM tags; for example:

    Essay: <INPUT TYPE="file" NAME="attachment2" SIZE="40">
    Transcript: <INPUT TYPE="file" NAME="attachment3" SIZE="40">
    Application: <INPUT TYPE="file" NAME="attachment1" SIZE="40">

    The TYPE and NAME values must be specified exactly as shown in the tags above, ending with the appropriate number; only the SIZE attribute value may be freely modified.

  4. Do not attempt to combine the single-file method documented in the prior section with this multiple-file method. Your reader will think it worked, but only some of the files will be attached to the resulting e-mail.

The files will be attached to the e-mail in the order of the field name values, not in the order in which they appear in the HTML. If you change the order of the fields, as seen by the user, you may, but need not, revise the field name values so that they are sequential again in the HTML -- choose the field name values so that the sequence of the attachments will be most convenient for the person dealing with the e-mail, and the placement of the fields in the HTML form to be most convenient for the person submitting the information.

With the current version of the MAILER software, if the user submits only some of the requested files, those submitted will be attached in their proper numerical order, but with no indication as to which ones were skipped.

In order to avoid "collisions" (e.g., if by chance, multiple people click the submit button at nearly the same time), the filenames of the attachments to the e-mail message may not match their original names on the user's system: they will be modified to be unique on the server while being processed. The changes, if any, will be the addition of one or more digits just before the period preceding the file type.

 

Example

 

 

 

The HTML

 

<form action="http://www.ohio.edu/mailer/index.cfm" 
  ENCTYPE="multipart/form-data" method="post">
<INPUT TYPE="Hidden" NAME="Email_To"
  VALUE="webteam@ohio.edu">
<INPUT TYPE="Hidden" NAME="Email_From"
  VALUE="bogus.unperson@ohio.edu"> 
<INPUT TYPE="Hidden" NAME="Subject" 
  VALUE="testing the MAILER mailto script"> 
<INPUT TYPE="Hidden" NAME="Redirect"
   VALUE="http://www.ohio.edu/pagemasters/static/append5.html#mailto3">
<INPUT TYPE="checkbox"
  NAME="CheckboxAlpha"
  VALUE="check-box A" CHECKED > Choice A 
  (checked by default because of the CHECKED keyword in the HTML).
<P>
<INPUT TYPE="checkbox" NAME="CheckboxBeta" 
  VALUE="checkbox B"> This is choice B.
<input type="hidden" name="blank_lines_1" value="3">
<P>
Pick the file you want to upload.  Remember that it will arrive as 
an attachment to the e-mail message, so don't make it too large!
<P>
<INPUT TYPE="file" NAME="attachment" SIZE="40">
<P>
Explain the meaning of life:
<P>
<TEXTAREA NAME="Meaning_of_Life" COLS="55" WRAP="hard"
  ROWS="10">When you fill the box, scrolling will be enabled, so that 
  you can complete your response.</TEXTAREA>
<input type="hidden" name="blank_lines_2" value="2">
<P>
<BR>
Enter your phone number:
<input type="text"
  name=f01
  maxlength=14  
  size=14
  value="(xxx) xxx-xxxx">
<P>
Enter your comment:
<input type="text"
  name=comment  maxlength=60    
  size=60
  value="">
<P>
<BR>
<SELECT NAME="unit" TYPE="text" SIZE=1>
<OPTION VALUE="art">School of Art
<OPTION SELECTED VALUE="default">The default, because of the "SELECTED" 
  keyword in the HTML.
<OPTION VALUE="artsci">College of Arts and Sciences
</SELECT>
<P>
<BR>
<input type=radio name="RadioButton1" value="TIME" checked > Class Times 
<P>
<input type=radio name="RadioButton1" value="ENROLL" > Class Enrollment
<P>
Because the names of these two fields are the same, the browser 
identifies them as part of the same radio button set, and only permits 
one at a time to be engaged.
<P>
<BR>
<center>
<input type="reset" value="clear fields">
   
<input type="submit" value="submit">
</center>
</FORM>

 

 

The Working Form Itself

 

See the demo page.