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).
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.
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 :
to(mandatory) : the address of the recipient
subject: the subject given to the email being sent
from: the address of the sender
name: the name of the sender
firstname: the firstname of the sender
replyto: if this field is set, a ReplyTo: email header with the sender address is set in the outgoing email
template: filename of the plain text email template file, relative or absolute path
HTMLtemplate: filename of the HTML email template file, relative or absolute path
TABtemplate: filename of the TSV (tab seperated values) email template file, relative or absolute path
redirect: web page to redirect to after the form has been filled
DEBUG: if this field is set a debugging page is printed with all values as the are passed to the cgi
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.