MailForm Version 1.2.2, 1/2000
HTML form to e-mail gateway CGI Written by Kelly Yancey

MailForm 1.2 Introduction

MailForm 1.2 Configuration Fields


MailForm can be used as a generic HTML form to e-mail gateway with just a few restrictions on the HTML form fields and their contents.

HTML Form Configuration:
The action of your form needs to point to where you have installed MailForm on your web server, and the method must be POST or GET in capital letters. MailForm offers many ways to code your form to tailor the resulting HTML page and the way the script performs. Below is a list of configuration form fields you can use and how to implement them. Any fields that are not configuration fields are included in the generated e-mail; multiple fields with the same name are grouped together.

Configuration Form Fields:
Below is a description of all the form fields parsed by the MailForm CGI. Of these fields, none are required to be in the HTML form except for the recipient to whom to send the result via e-mail. Except where specified, if multiple configuration fields with the same name are given in the HTML form, only one will be used; which one is random. Typically, you would add these fields to your form as hidden fields. Any form fields with names not listed here are considered non-configuration fields and as such, compose the contents of the e-mail that is sent when the user submits the form.

Field Name Description
recipient

Allows you to specify the e-mail address you want the form values to be sent to. This field is required. If for some reason you do not want MailForm to send an e-mail message, put the special value "*none*" as the recipient. You can send e-mail to multiple recipients simply by including multiple recipient fields in the HTML form.

subject

Allows you to specify the subject of the e-mail message that is sent.

email

If you have a form field named email, the value of that field will be used in the return address of the e-mail sent. Unlike most other configuration fields, typically you do not want to hide this form field so that the user can type in their e-mail address. If the email field is listed as a required field (see the required configuration field below) then basic checking is performed to try to ensure that it is a valid e-mail address.

realname

If you have a form field named realname, the value of the field will be included in the return address of the e-mail sent. Unlike most other configuration fields, typically you do not want to hide this form field so that the user can type in their real name.

title

Allows you to set the title of the web page the is generated when the user submits the form.

header

Allows you to specify the text that is displayed in the header of the web page that is generated when the user submits the form.

background

Allows you to specify a background image to use on the web page that is generated when the user submits the form. This is equivilent to the "BACKGROUND" attribute of the "BODY" HTML tag.

bgcolor

Allows you to specify a background color to use for the web page that is generated when the user submits the form. This is equivilent to the "BGCOLOR" attribute of the "BODY" HTML tag.

link_color

Allows you to specify the default color of the hyperlinks on the web page that is generated when the user submits the form. This is equivilent to the "LINK" property of the "BODY" HTML tag.

alink_color

Allows you to specify the color hyperlinks turn when clicked on the web page that is generated when the user submits the form. This is equivilent to the "ALINK" property of the "BODY" HTML tag.

vlink_color

Allows you to specify the color of visited hyperlinks on the web page that is generated when the user submits the form. This is equivilent to the "VLINK" property of the "BODY" HTML tag.

text_color

Allows you to specify the color of the text on the web page this is generated when the user submits the form. This is equivilent to the "TEXT" property of the "BODY" HTML tag.

font_size

Allows you to specify the size of the font that is used on the web page generated when the user submits the form. This is equivilent to the "SIZE" property of the "BASEFONT" HTML tag.

style_sheet_URL

Allows you to specify an external style sheet to be applied to the web page generated when the user submits the form. The style sheet must be in CSS format as defined by the W3 consortium (http://www.w3.org/pub/WWW/TR/REC-CSS1)

return_link_URL

Allows you to specify the URL of the return hyperlink on the web page generated when the user submits the form.

return_link_title

Allows you to specify the text of the return hyperlink on the web page generated when the user submits the form.

redirect

Allows you to specify a full URL to take the user to after submitting the form rather than have MailForm generate a web page. The value must be a full URL, for example, http://www.posi.net/, it cannot be a relative URL.

print_config

Allows you to list the configuration form fields you would like to be included in the e-mail sent. Normally configuration form fields are only used by MailForm to affect the way it operates and are not listed with the other non-configuration form fields in the e-mail that is sent. If the "print_config" form field is set, the configuration fields listed as "print_config"'s value are included in the e-mail. The value is a comma-delimited list of configuration form fields to include in the e-mail.

env_report

Allows you to list server environment variables that you would like included in the e-mail MailForm generates. The value is a comma-delimited list of server environment variables; typically available environment variables include:

  • REMOTE_HOST - the client's domain name
  • REMOTE_ADDR - the client's IP address
  • HTTP_USER_AGENT - the client's web browser ID
  • HTTP_HOST - the client's host name
  • SERVER_SOFTWARE - the web server software
  • SERVER_PROTOCOL - the protocol used to make the request (typically HTTP/1.0)
  • SERVER_ADMIN - the web server admin's e-mail address
  • SERVER_NAME - the web server's host name
  • HTTP_COOKIE - cookies sent from client
required

Allows you to specify a list of non-configuration fields which must be completed by the user before the results will be e-mailed. The value is a comma-delimited list of non-configuration fields.

missing_fields_redirect

Allows you to specify a full URL to take the user to if required fields are missing rather than MailForm generating an error message indicating that they must fill out required fields before submitting. The value must be a full URL, for example http://www.posi.net/, it cannot be a relative URL.

sort

Allows you to sort the non-configuration fields as they are displayed to the user when they submit the form and as they appear in the e-mail. The value can be any of the following:

  • "alphabetically" - sort the fields alphabetically
  • "alphabetic" - sort the fields alphabetically
  • "alpha" - sort the fields alphabetically
  • "-alphabetically" - sort the fields inverse alphabetically
  • "-alphabetic" - sort the fields inverse alphabetically
  • "-alpha" - sort the fields inverse alphabetically
  • "order: list,..." - specify the order of the fields by giving a comma-delimited list of the non-configuration fields in the order you want them to be displayed.
mailheader

Allows you to specify a single mail header to be inserted in the top of the e-mail message. You can include multiple mail headers by including multiple mailheader form fields in the HTML form. This replaces the mailheaders field implemented in MailForm 1.1, allowing mail headers to include a comma which the mailheaders field does not.

mailheaders

Allows you to specify a comma-delimited list of mail headers you want inserted in the top of the e-mail message. Obsoleted by mailheader field.

set_cookie

Allows you to send a single cookie to the user when they submit the form. The value is the cookie information you want to send them. You can send multiple cookies by putting multiple set_cookie fields in the HTML form. The format of a HTTP cookie is as follows (all on one line, values in brackets are optional):

    name=value
    [;EXPIRES=dateValue]
    [;DOMAIN=domainName]
    [;PATH=pathName]
    [;SECURE]

name=value is a sequence of characters excluding semicolon, comma and white space.

EXPIRES=dateValue specifies a date string that defines the valid life time of that cookie. Once the expiration date has been reached, the cookie will no longer be stored or given out. If you do not specify dateValue, the cookie expires when the user's session ends.
The date string is formatted as:

    Wdy, DD-Mon-YY HH:MM:SS GMT

where Wdy is the day of the week (for example, Mon or Tues); DD is a two-digit representation of the day of the month; Mon is a three-letter abbreviation for the month (for example, Jan or Feb); YY is the last two digits of the year; HH:MM:SS are hours, minutes, and seconds, respectively.

DOMAIN=domainName specifies the domain attributes for a valid cookie. If you do not specify a value for domainName, the user's browser uses the host name of the server which generated the cookie response.

PATH=pathName specifies the path attributes for a valid cookie. If you do not specify a value for pathName, the user's browser uses the path of the document that created the cookie property.

SECURE specifies that the cookie is transmitted only if the communications channel with the host is secure. Only HTTPS (HTTP over SSL) servers are currently secure. If SECURE is not specified, the cookie is considered sent over any channel.

Return to the MailForm Introduction page


Rated with RSACi Designed with style Valid HTML 4.0!

Copyright © Kelly Yancey, 1997, 1998