mailform: web form emailer

mailform processes and emails the contents of a submitted web form

Usage

mailform [-a] [-n nextpage-URL] [-s subject] address

where "address" is an email address to which the posted data is to be sent. This address does not generally have to be on the server on which mailform runs (see below for more information on this). The field=value pairs are included in the email, one pair per line.

Brackets indicate options (but are not typed). The -s option is used to specify the subject of the email and the -n option is utilized to indicate the web page to be displayed after the email is sent. Options are described further below.

The above synopsis is the way one would use mailform as a Unix command. Since mailform is actually used from within an html file, things are rather different. The simplest example is when only the address is specified, e.g.,

<form method=POST action="http://www.psych.upenn.edu:/cgi-bin/mailform?baron@psych.upenn.edu"> Note the question mark separating the URL for mailform (http://www.psych.upenn.edu:/cgi-bin/mailform) and the email address (baron@psych.upenn.edu).

When you use options, the question mark goes between "mailform" and the first option, and multiple options are separated by plus signs, e.g,

<form method=POST action="/cgi-bin/mailform?-a+-n+http://www.psych.upenn.edu/~hurtubis+hurtubis@sas.upenn.edu"> An explication of what these options specify is provided below, and other examples of how to use mailform follow an explanation of the various options.

Options

-a: order the field=value pairs per the alphabetical order of the fields

If -a is not specidifed, the field=value pairs are in the order sent by the browser, i.e., the same order as in the html form file.

-n: display a specific page after processing the form

A plus sign (+) is needed between -n and the URL of the page to display,i.e,

    -n+nextpage-URL
with nextpage-URL is the URL of a page to display after processing the form. For example,
    -n+http://www.psych.upenn.edu/~baron
instructs mailform to display the page http://www.psych.upenn.edu/~baron

If -n is not used, mailform displays the simple acknowledgement message

 
          Thanks you!
 
          I have mailed the contents of the form to address
with "address" the email address specified as an argument to mailform.

-s: subject header

If you don't provide a subject header, mailfrom provides a default one (see below). With -s, you can specify the subject header. You need to replace each blank by the three characters %20. For example, the subject header

             This is a test!
is specified as -sThis%20is%20a%20test!

The default subject header is

            WWW form from REMOTE_HOST
with REMOTE_HOST the name of the computer used by the person who filled the form. If REMOTE_HOST is unknown, but the IP (REMOTE_ADDR) of the computer is known, the subject is
            WWW form from REMOTE_ADDR
If both REMOTE_HOST and REMOTE_ADDR are unknown, the subject header is
            WWW form from unknown

Examples

Example 1

<form method=POST action="/cgi-bin/mailform?baron@psych.upenn.edu">

mailform emails the field=value pairs to the specified email address, here "baron@psych.upenn.edu". The pairs are in the same order as in the form and the generic "thank you!" page is shown after processing the form. This is the default behaviour.

Example 2

<form method=POST action="/cgi-bin/mailform?-a+-n+http://www.psych.upenn.edu/~hurtubis/thankyou.html+hurtubis@sas.upenn.edu">

Because of the -a, the field=value pairs are in alphabetical order of the fields. The -n option is used to have mailform display the web page http://www.psych.upenn.edu/~hurtubis/thankyou.html after sending the email. The message is sent to "hurtubis@sas.upenn.edu".

Example 3

<form method=POST action="/cgi-bin/mailform?-sImportant%20survey%20data!-n+http://www.psych.upenn.edu/~hurtubis+hurtubis@psych.upenn.edu"> The -s option specifies "Important survey data!" as the subject header of the email mailform sends. The -n options instructs mailform to display the web page http://www.psych.upenn.edu/~hurtubis after sending the email. The email message is sent to hurtubis@psych.upenn.edu
Comments to: hurtubis@psych.upenn.edu