Main >> Hobbies & Interests >> Internet

 
Description of /cgi-bin/email

AOL /cgi-bin/email Feature

Last updated: September 14, 1999

Table of Contents

  1. Description
  2. Setting It Up
  3. Details & Suggestions
  4. Frequently Asked Questions


Description

This feature is available for AOL members who have pages hosted on hometown.aol.com or members.aol.com.

The electronic mail feature allows you to collect information from people browsing your web pages and email the information to you.  You define what information to collect by creating a HTML form and you define the format of the email message by creating a template.  A member retrieves your form, fills it out and presses the submit button. A members.aol.com server uses the template and forms data to format and send you an email message. The member sees an HTML page that reads Thank You!. (See the ResponsePage option in the Details & Suggestions section below to find out how to add a customized thank you page.)


Setting It Up

STEP 1: Create a Form

Create a form with the action set as follows.

<form action="/cgi-bin/email/screenname/template.eml" method="POST">

Replace screenname with your AOL screen name and template with a name of your choice.

STEP 2: Create a Template

Create a template file (name ending with .eml) and put that file in your web directory on members.aol.com. A template is a simple text email message with markers (e.g., #fieldname#) that get filled in with the appropriate form data.

Here's a sample template file:

I'm interested in information about #topic#.

My name is #name# and I can be reached at #email#.

Thanks!


Details & Suggestions

  • See http://members.aol.com/wwwadmin/email/example.htm for an example form and http://members.aol.com/wwwadmin/email/example.eml for an example template.
  • Try using one of the templates created by Building Home Pages.
  • The form and template need not be located in your top level directory.  However, the template may not appear in your FTP incoming directory.
  • If your form name is feedback.html, a good choice for the associated template file might be feedback.eml.
  • You may have multiple email forms and templates.
  • If the form has a field named subject, the email message will have that value as its subject. Otherwise, the subject will be Form Mail.  If you wish, this field may be hidden by defining it as type=hidden in the form.  See this example.

    <INPUT TYPE="hidden" NAME="subject" VALUE="web site feedback">

  • If you want to require members to provide values for some fields, add a hidden field named required to your form. The value of the field should be a comma separated list of the required fields.   See this example.

    <INPUT TYPE="hidden" NAME="required" VALUE="topic,email">

  • Users of your forms will normally get back a simple page that reads Thank You!. You may specify a custom response page by adding a hidden field named ResponsePage to your form. The value of the field should be the URL of the page you want returned.  See this example.

    <INPUT TYPE="hidden" NAME="ResponsePage" VALUE="http://members.aol.com/screenname/thanks.htm">

  • The POST must be done from a form hosted by AOL. If this is not true, the email request will be denied.
  • If you wish to have the POST date included in your email, insert #date# into the template.
  • If you wish to have the POST time included in your email, insert #time# into the template.
  • Field names are considered to be case insensitive.  For example, a field named Comments in the form will match a field named comMEnts in the template.
  • By default, any HTML tags entered into a form field will be stripped before inserting into the email. If you want your users to be able to insert HTML, include a hidden field named AllowHTML in your form. The value of the field should be yes.  See this example.

    <INPUT TYPE="hidden" NAME="AllowHTML" VALUE="yes">

  • The size of the template file is limited to 100,000 bytes.


Frequently Asked Questions

I've read the instructions and tried it.  I just can't get it to work.  Who can help me with my problem?

Try posting details of your problem to a Building Home Pages message board. See the WWWAdmin Home Page for additional sources of AOL help.

Why does the email have my email address as both the sender and recipient?

There is no foolproof way for the web server to automatically determine the email address of the person who submits the information.  If you want the person's email address, add a field to your form and include it in your template.

How long should it take before the email arrives?

Normally, it takes a few minutes. Sometimes mail is delayed due to long mail queues but rarely does a message get lost.

Should I put HTML into my template?

The contents of the template is dependent on what you intend to do with the email you get. If you plan to just read it, you probably don't want any HTML in the template. If you save the email and display it as a web page then you may want HTML in it.

Should my form use the ENCTYPE="text/plain" attribute?

No.  The ENCTYPE="text/plain" attribute can be used with a mailto URL to make the form data more easily readable by humans.  This attribute should not be used with cgi-bin/email since the data will be processed by a computer.  With cgi-bin/email, your template is used to convert the data into a readable form for you.

How can I verify the information entered by the user?

If you want to just verify specific fields do not have empty values, use the required hidden field described above. If you need more sophisticated verification, give JavaScript a try.  Note that JavaScript is supported in most but not all web browsers.

The thank you page caused a problem because I am using Frames.  The end user has no way to go back from the thank you page to my page very gracefully.  What can I do?

There are 2 different ways that this can be addressed by changing the form.

  1. In addition to the action and method attributes in the FORM tag, add the target attribute, e.g., target="_top".
  2. If most of the links on your page are directed to the same location, you can use the BASE tag in the header to set a default destination and avoid specifying it for each reference. This will also apply to the form post.  For example:
<HEAD>
<TITLE>Ralph's Home Page</TITLE>
<BASE TARGET="_top">
</HEAD>

I get the following message. The template /myscreenname/cgi-bin/email/mytemplate.eml could not be accessed. How do I correct the problem?

First make sure that your template really does exist. If it does, be sure your form action begins with a slash, i.e.,
action="/cgi-bin/email/mytemplate.eml"

rather than
action="cgi-bin/email/mytemplate.eml".

When a leading slash is omitted, the location of the cgi-bin directory will be incorrectly relative to the directory that contains the form.