Monday, 18 December 2017  
3.1.12 TMail: Templated Mailer - like formmail, only MUCH better

What is TMail?
TMail is a simple, but powerful CGI tool used for sending web based form results to one or multiple email accounts. TMail requires NO CGI KNOWLEDGE to use! You may need BASIC knowledge of HTML and Web Forms to use TMail. At no time should the tmail.cgi script itself be editted or modified.

The simple setup:
The simplest way to have TMail just send you the info from your form is to using the following form method, action and hidden tags. All you have to do is change the _MAILTO value to YOUR email address and you're done:

    <FORM Method="post" Action="/cgi-bin/tmail/tmail.cgi">
    <input type="hidden" name="_MAILTO" value="">
    <input type="hidden" name="_SUBJECT" value="Form Mail From">
    <input type="hidden" name="_THANKS" value="/thanks.html">

This FORM and INPUT set can be used with any precreated form.

A few common forms are available here. Just grab the form HTML, throw it into your page and presto you've got a working form!

*** NOTE: *** *** NOTE: *** *** NOTE: *** *** NOTE: ***

The following information and documentation is for
advanced users ONLY. If you are not familiar with
CGI scripting & forms, please use only the
"simple setup" basic configuration found above!

*** NOTE: *** *** NOTE: *** *** NOTE: *** *** NOTE: ***

Form Tag:
Your FORM HTML tag for TMail should look something like this:

     <FORM Method="post" Action="/cgi-bin/tmail/tmail.cgi"> 
This may vary depending on the location your CGI-BIN directory and other system settings.

HIDDEN Variables:
These are variables that you MAY set with in your <FORM></FORM> tags.  It is suggested you use HIDDEN INPUT tags to place these variables.  Example: <input type="hidden" name="_MAILTO" value="">.

  • _MAILTO - The address to which TMail should mail the form results. Separate multiple email addresses by commas;
  • _MAILCC - The carbon copy addresses for the form results. Separate multiple email addresses by commas;
  • _MAILBCC - The address to which TMail should blind carbon copy the mail of the form results. Separate multiple email addresses by commas;
  • _SUBJECT - The subject line of the mailed results;
    I.E. Form Results
  • _FROMEMAIL - This variable determines where the form mail will be sent FROM. It is best that this variable is only set to a single email address. See "Setting the "FROM" address of the form response:" in the documentation below for more details on how this variable can be used.
  • _OCLOSE - The opening symbol for the response. To enclose the response in brackets, this would be [;
    I.E. [
  • _ECLOSE - The closing symbol for the response.  To enclose the response in brackets, this would be ];
    I.E. ]
  • _TEMPLATE - The name of the mail template this form submissions should shaped around.
    I.E. example
  • _MISSING - The URL to forward people to if they missed a field when filling out this form;
    I.E. /missinginfo.html
  • _THANKS - The URL to forward visitors who successfully fill out the form to;
    I.E. /thanks.html
  • _LOG - Logging allows you to better keep track of your form uses. It is also very useful if you are trying to debug a problem with your TMail implementation.
          A value of "1" will turn on extended logging; this setting contains the most information about the form mail being sent.
          A value of "2" will turn on status logging; this setting is for those who just wish to keep track of the number of uses a particular form receives.
          A value of "3" will turn on brief loggin; this setting is a nice middle ground and will contain the status information as well as the visitor's email address (using the _FROMEMAIL variable) if it is available.
    I.E. 0
    I.E. 1
    I.E. 2
    I.E. 3
  • _LOGPATH - This variable allows you to specify the location of your TMail log file. The default value is $CgiPath/tmail/logs/tmail_log ($CgiPath is replace by the path to your cgi-bin). Unless you are trying to do something special with logging, such as different log files for different forms, you should not use this variable. TMail also allows for automatic log rotation through the allowance of year, month and day variables within the _LOGPATH.
          %DAY% will be replaced by the present day.
          %MONTH% will be replaced by the present month.
          %YEAR% will be replaced by the present year.
    I.E. /home/WWW/
    I.E. /home/WWW/
    I.E. /home/WWW/
    I.E. /home/WWW/
    I.E. /home/WWW/

  • _NOLOGHOST - This variable allows you to specify whether the hostname (or IP address) of the person filling out the form should be logged. Obviously this will only work with logging turned on and will be logged with any logging level you choose. This variable defaults to 0, which means hostnames WILL be logged. Set it to 1 to turn it off.
    I.E. 0
    I.E. 1
NOTE: It is important to remember that all TMail internal use variables (such as those just above) MUST begin with an UNDERSCORE ("_") and MUST be in all CAPITAL letters. ALSO NOTE: _MAILTO is the only REQUIRED hidden variable.

Setting the "FROM" address of the form response:
The _FROMEMAIL variable can be used to specify the "From" address of the mail form response. It is especially convenient to request your visitor enter their e-mail into an input type such as:

    <input type="text" name="_FROMEMAIL" size=30>
This will send the mail as if they sent it from their email box allow you to simply reply to the form response in order to reply to them. You can also set this yourself using a hidden tag such as:
    <input type="hidden" name="_FROMEMAIL" value="">

TMail Templates and The Template Editor:
TMail uses templates to make your form output more legible.  A template editor should have been installed when you installed your tmail scripts and is generally located at: /cgi-bin/admin/tmail/editor.cgi.  This address may depend on your system settings.

The editor is simply a web based text editor. It is provided as a convenience only. You are not required to create your templates using the editor. It may be easier to use a regular editor for larger templates. You can edit your templates in a normal text editor offline and then deposit them in your cgi-bin/tmail/Templates directory. To create a template, just lay out the text the way you wish to receive it in e-mail. Enclose variable names within brackets ("[" and "]").

You may NOT have more than one variable on a TMail template line. TMail will only parse ONE variable per line of the template.

Requiring Variables With The Template:
A "*" just after the _OCLOSE marker (which is standardly "[") REQUIRES that field be filled out. This * SHOULD NOT be in the name="" field of your input tag. It should only appear in the template. Please see the example template below, or one of the PLUG-N-PLAY Forms for an example of implementing required variables.

An Example Template:

      Request For Information

       First Name:  [*fname]
        Last Name:  [*lname]
          Address:  [*address1] 
             City:  [*city]
            State:  [*state]
          Country:  [*country]
      Postal Code:  [*postal]

     Phone Number:  [*phone]
       Fax Number:  [fax]

    Email Address:  [email]

       Email Info?  [emailinfo]
         Fax Info?  [faxinfo]

Note: The HTML form for the above template specifies "faxinfo" and "emailinfo" to be checkboxes with the value set to "YES"

Sample TMail Forms and Templates:
Link to our Example Form or PLUG-N-PLAY Forms. These will give you a base to work with if need be. The template "example" from the example form does exist and can be editted from the template editor online. All templates found in the PLUG-N-PLAY Forms exist as well.

Other Information Reguarding TMail:
Use of this script is FREE so long as you do not modify it in any way. Modification of any type must be approved in e-mail by

1 2 3 HostMe! clients requiring support for this script should email

All versions of TMail have been written and modified by:
Kenn Wagenheim (

Latest Updates

This is to inform you that our business have been succeeded by Loyal Software Private Limited with effect from 01 Oct 2011. We hope that M/s Loyal Software Private Limited will continue to provide the same high quality products and service.
Domain Name Availability
Most Popular Extensions ::
com net org
info biz us
in name
» More Extensions
.com, .net, .org,
.biz, .info, .name,,,
Linux Hosting &
    Windows Hosting
      JSP, .NET, ...
Search Engine
Google, Yahoo,
         MSN, Ask, ...
Privacy Policy | Terms of Service | Site Map | Disclaimer Policy | Cancellation and Refund Policy
Copyright © 2010 Penta Infoway, All Rights Reserved.