E-mail Template

Mail Header

At the top of the mail template you can find the lines of the mail header. For example:

Carbon Copy
Blind Carbon Copy:


You can define the recipient of an e-mail like this:

To: name@example.com

In addition, you can add several recipients with carbon copy and blind carbon copy:

Cc: mail@example.com, chef@example.com
Bcc: secret@example.com

Please note: If you have set your e-mail account as "Catch all", you can not send more than one e-mail to one domain. If more than one e-mail is sent to a domain, only one will be received. The following example will not work:

To: name@example.com
Cc: chef@company.com

You can define the sender within the mail template. For example:

From: chef@example.com

You can also use information from the form. For example:

From: {email}

You also can add the name of the sender. In this case the name is followed by the e-mail address which stands between angle brackets.

From: "{firstname} {lastname}" <{email}>

Mail Body

After the e-mail head area (header) an empty line (two line breaks) follows. Below that line follows the mail content. You can customize the mail content as you like. If you add fields to your form, you will also need to place the name of those fields as placeholders in the mail template.

Make sure that the names of the fields in your form are identical to the placeholders in your mail template.

Confirmation e-mail (Auto Responder)

You can create an auto responder message to the person who submitted the form by creating another mail template. The To: line of the new template contains - instead of your own e-mail address - the e-mail address that the user supplied. You can find an example in the /templates/examples/mail_auto_responder.tpl.txt.

The definition of the mail template looks like this:

<input type="hidden" name="mail_template" value="mail.tpl.txt, mail_auto_responder.tpl.txt">

The definition in index.php:

$file['default_mail'] = 'mail.tpl.txt, mail_auto_responder.tpl.txt ';

Display all form data with one placeholder

You can display all form data with just one placeholder. Add following placeholder to the e-mail template:


If you have your mail template formatted as HTML e-mail, you can use following placeholder.


This placeholder shows all form field values structured in an HTML table.

Environment variables and server date and time

The following environment variables are provided by Form Mail Script. In order to make these variables appear in an e-mail you need to put following placeholders in your template:

{env_user_agent} - Browser software of the user (Mozilla, Internet Explorer)
{env_remote_address} - IP-Address of the user
{env_remote_host} - Host name of the user
{env_year} - Year
{env_month} - Month
{env_day} - Day
{env_hour} - Hour
{env_minute} - Minutes
{env_second} - Seconds