Contact | Privacy | Datenschutzerklärung | Impressum

Mail Form Application Components

A mail form is a form that sends the user's input by e-mail to designated recipients. Mail forms are among the most common Web applications, as evidenced by the number of Web sites which make use of them. Mail forms are extremely useful, whether their purpose is to reply to a message, submit comments about a Web site, request information, or fill out an order form.

heitml mail forms offer a number advantages over traditional HTML. For one thing, the mailform component is a lot easier to implement. To process an HTML form, some sort of scripting language such as PERL must be used. Though PERL is an easy language to learn, the script itself must be stored in a separate file, and PERL syntax is different from that of HTML. Also, most ISPs require you to submit PERL scripts for testing by their own in-house personnel before allowing them to be placed into production on your Web site.

heitml email forms share the full power of the heitml forms. You can add many different field components to a form. They offer various form controls and various ways to check the field content for consistency. Unlike simple solutions in case of an error the mailform is redisplayed with the data entered and a useful error message.

With heitml mail forms you can flexibly define the email text sent, without editing or changing a program. Other features (that can be activated) are

  • a Preview button to display the email generated to the user
  • an Edit button to allow the user to edit the email before sending it
  • a checkbox where the user can request an email for him/herself

Mail Form Basics

The mailform component sends its data via e-mail. It provides a way to define mail recipients, subject, and so on. The mail form can contain field components. The mailformbutton component provides buttons to send mail, reset the form, and to preview or edit the mail text. (See the section on previewing below for details on the latter.)

Mail forms compose and send e-mail from the form data. An email form must contains some field components (to enter some data) and a send button (mailformbutton).

Mailforms usually contain a mailtext component that defines the text that will actually be sent. A mailform can contain a preview and/or edit button so that the user can see or edit the generated email before sending.
Property Kind Description
OidId Id must be unique within the page. 
ToString(20) Recipient's e-mail address. 
CcString(20) List of carbon copy recipients, separated by commas. 
BccString(20) List of blind carbon copy recipients, separated by commas. 
SubjectString(50) Subject line. 
FromString(20) Sender's e-mail address. 
UsercopyCheckbox Send a copy to the user. A Mailuseraddress field must be on the form to use this function. 
MethodString(60) HTTP method to submit the form data set.
Value "post" should be used when form processing causes side effects, e.g. modifies a database, and if the form contains fieldfileupload.  

Mail form button.
Contents or value are used to render the button.
Property Kind Description
NameString(10) Button name. 
LayoutString(60) Input is a standard HTML submit button, image shows an image on the button, link creates a link (needs JavaScript), compatlink a link or button depending on the browser, button an HTML4.0 button (must occur just once at end of form), mbutton an HTML 4.0 button (needs JavaScript), and compatbutton an HTML 4.0 button or normal button depending on the browser;  
TypeString(60) Select the button's action:
Value "send" sends the mail form's mail.
Value "reset" resets the fields to their initial values.
Values "preview" and "edit" control the mail form's mailpreview component.  
SrcString(20)  Image Url, only used for layout=image  
BorderInteger Border Size, only used for layout=image  
StateString(60) Is button disabled? 

Assembling the Mail Text

The mail form assembles the mail text from the values entered by the user. You can use the mailtext component to customize the mail text. Its content is a template for the mail text, and the mtf component may be used to insert field values. Alternatively, you can use the full power of the heitml programming language to generate the mail text; the variable ff contains the field values for convenience.

Mail form mail text template.
Content is evaluated to compose the mail text. Use the following components inside the text to insert form fields and other information into the text mtfInsert a form field value into the email text.
mtfallInsert all form fields into the email text.
mtfclockInsert date and time into email text.
mtfremoteInsert information on the remote host.

Insert a form field value into the email text. Useful inside mailtext component.
Property Kind Description
NameString(10) Field Name 
FormatString(60) Formatting 

Insert a table of all form field names and values into the email text. Useful inside mailtext component.

Insert date and time into the email text.
Property Kind Description
FormatString(60) Display format (Documentation)  

Insert information on the remote host into the email.
Property Kind Description
ShowipCheckbox Include IP address 

Previewing the Mail Text

The mailpreview component provides a preview panel. Its content is hidden until the user presses a preview or edit button. The mailtextarea component should be used to display the content of the mailtext. Aside from that, arbitrary markup is possible, and a reset button cancels the preview panel.

Sub-panel to preview or edit a mail form's mail text.
Property Kind Description
OidId Id must be unique within the page. 

Mail form text preview/edit field, use within the mailpreview component.
Property Kind Description
RowsInteger Area height in characters. 
ColsInteger Area width in characters. 
WrapString(60) Control automatic wrap in edit mode.
FormatString(60) Formatting in preview mode  
EnvString(60) Text Block Formatting in preview mode  

Sending a Copy to the User

The mailuseraddress component is a field component which allows the user to request that a copy of the e-mail be sent to the e-mail address entered in that field. In addition the Usercopy checkbox in the mailform component must be checked.

Caution! Nothing prevents a malicious user from entering any e-mail address he wants, tricking you into sending unsolicited mail to third parties. This is considered offensive by most people, and may be illegal in some countries. This could get you in really, really deep trouble, if you allow the user to edit the content of the mail, too.

Mail form field for user's mail address.
Property Kind Description
NameString(10) Field name. 
SizeInteger Field size in characters. 
ValueString(20) Initial field value. 
MandatoryCheckbox Check to require the user to fill out the field. 
DescrString(20) A description of the field value. 
ErrmsgString An error message that is shown if the user enters a wrong value. 
StateString(60) Is field disabled? 

Mail has been Sent, What Now?

You can use the mailsent component to display an acknowledgment after the mail has been sent. Optionally, the mail form itself can be hidden, so that only the acknowledgment is visible.

Contents is displayed after the mail form sent mail.
Property Kind Description
HideformCheckbox Check this box to hide mail form after mail has been queued. 
ShowtextCheckbox Check this box to show the text for editing. 


You can program an email form to perform various checks on the data entered. See mailform and .

This page was dynamically generated by the web application development tool RADpage of H.E.I. Try the AJAX Article (in German) on
© 1996-2024 H.E.I. All Rights Reserved.

Component Guide
    Database Display
    Database Search
    Record Display
    Database Update
User Guide
Contact / Impressum