This section of the documentation is not necessary to make a
working form. Templates are intended to make htmail more
flexible, but are not necessary. Using these templates, it is
possible to format the e-mail message sent by your form in
virtually any way you like. This could be used to make the
submitted form easier to add to a database program or simply to
make the submitted form more attractive and readable.
HTMail uses template files based on the Server Side Include
(SSI) Standard. More information on SSIs is available from:
To make the e-mail
address of the user appear in your template, you would use the tag:
<!--#echo var="from" -->
Be very careful that the variable names in your template file
exactly match the form field names in your htmail form.
This will ensure that the completed form will be passed along
and sent to you in e-mail.
Step One: Create Your Template Directory
The following command, when issued on one of the ITD login
servers, will create the necessary directory structure:
% mkdir -p ~/Public/html/cgi-data/htmail
To create the template file for a group directory, use:
% mkdir -p ~groupname/Public/html/cgi-data/htmail
Where groupname is the name of your group. In either case, be
sure to leave off the "%" when copying the command. It is only
there to demonstrate that these are UNIX commands.
Step Two: Create A Template
A template is simply a text file with SSI tags added. HTML
will not work unless you use an e-mail client that interprets
html tags. You can create this file using any text editor and
save it in your newly created template directory.
An example of a template file may be
helpful as a starting point.
This template expects to be called from a form with fields
called from, body, and name.
Step Three: Add the "template" Tag to Your Form
The next step is to add the "template" tag to your form. This
tag allows you to specify the file name (with no forward
slashes allowed) of your template file. In a simple web form
this looks like:
A simple htmail form with the
Another tag, the "template_source" tag, allows you to specify
an IFS home directory other than your own if needs be. In most
cases, this will not be necessary and you will not need to use
the template_source tag.
Step Four: Test
Fill in your form completely and make sure all of the
information you submit comes to you in e-mail. A good way of
testing web forms is to fill in all the fields with that
field's name (this only works for text inputs and text areas).
This method allows you to see quickly and easily which fields,
if any, are having problems.
If you do find any problems, be sure to correct them and re-test.
NOTE: If htmail has difficulty finding your template file it
will send the message in the default format and give you some
messages (via e-mail) about the problem with your template. No
template error messages are ever given to the user of your form
so be sure to check the e-mail messages closely when you are