Download the script (3kb)
You can use this script with all your websites without having to change the
mail.php file.
Here are the instructions:
In the action element from your form tag you must link to the script.
eg. <form name="form" method="post" action="mail.php">
You must set three hidden fields called "recipient", "subject"
and "redirect".
eg. <input name="recipient" type="hidden" value="youremail@provider.com"
/>
<input name="subject" type="hidden" value="your
subject" />
<input name="redirect" type="hidden" value="http://www.yourdomain.com/redirect.html"
/>
Optional hidden fields are called "required" and "errorpage".
In the "required" field you can
specify the fields that need to be filled out, seperated by commas. The "errorpage"
field can contain
the url to the errorpage.
eg. <input name="required" type="hidden" value="name,address"
/>
<input name="errorpage" type="hidden" value="http://www.yourdomain.com/errorpage.html"
/>
Also if you make an input field called "email", that value will be
the sender and reply address.
eg. <input name="email" type="text" />
You can also send an autoresponse mail with the following hidden fields:
<input name="autoresponse" type="hidden" value="http://www.yourdomain.com/autoresponse.html"
/>
The value is a link to a custom webpage which contains a message e.g. 'I will
contact you back as soon as possible'.
The title (<title>my site</title>) of that webpage is the subject
of the autoresponse mail.
<input name="autoresponsefrom" type="hidden" value="Your
website name" />
In this hidden field you can specify the name of the sender. E.g. 'my site autoresponse
system'.
Warning: if you use the autoresponse option the 'email' inputfield is required.
This value will be the address for the autoresponse mail.
Changelog:
v1.1 - 10/09/04: Added the autoresponse option.
v1.2 - 30/07/05: Fixed bug when user leaves a field blank the output stops
on the email.
Thanks to Edwin Jeffords, Jr.