formemail.php : test page


This a sample HTML form that shows the use of the formemail script and the related Email.php and CodeEmail.php classes. Here are the templates used by the cgi script to send out a preformated email from this form : plain text template, HTML template and tab-seperated-values template (.tsv, useful for importing data into a database or a spreadsheet).

FORM definition

To use this formemail cgi script, you should make a <FORM> ... </FORM> with a post action calling the script, something like :
<form name="form1" method="post" action="formemail.php">. Every field present in the form should have a name identifying it and the same name being used in the template files to be parsed. If no template files are used, the script sends out a generic plain text email with all the fields and associated values replicated.

Predifined and useful fields

Some predifined fields must or can be used in the HTML form for the formemail script to behaves correctly. These fields can be of type hidden so they don't disturb the use of the form for the end user. Here they are :

Security and email addresses harvesting

It should be impossible for a user creating a form using this cgi script to request a file out of the apache public directories to be sent out.

Email addresses harvesting can be prevented by coding email addresses present in the form. A very simple scheme is used to code addresses, basicaly it's just reversing the addresss string and substituing the @ with a | and every . with a #. This little form gives you an easy way to encode your addresses before putting them into your form. The CodeEmail.php class is used for this encoding and decoding.

The use of these scripts on this server is carefully monitored to prevent abuses.


You can download the full package from here if you want.


This program and all related scripts are free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version.

This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.

You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.

v1.2.3 Copyright 2000-2004 Antoine Delvaux, Cassiopea.

The form

Text : txt1
Text with default value : txt2
Text : txt3
Text area : txt4
Text area with default value : txt3
One checkbox : ckb1 I agree
Multiple checkboxes : ckb2 WWW
Your website
Usenet news
Radio buttons : radio1 Yes No
One popup menu : sel1 Your choice :
One popup menu with two submenus : sel2 Your choice :
Multiple selections : sel2 and sel3 Choose some months and some years below :
The End !