Mailform allows the webmaster to create an elegant interface that users can use to send form information via email.
The Mailform has a few advantages over a standard <a href="emailto:..."> HTML hyperlink:
- Security - email addresses that are listed in HTML hyperlink may be stripped and abused by junk-mailers.
- Accessibility - public-use computers, such as those found in libraries, are often not configured to send conventional e-mail. The mailform allows the users of these facilities to contact you or your clients via e-mail.
- Consistency - the features of the mailform allow you specify pre-defined texts that make your e-mail more manageable.
- Get the information you need - perhaps the greatest benefit of using mailform is that you can collect the information that you need. The text fields can be configured to be required so the form will not process unless the information is provided.
Setting up a Mailform
Once you install the Mailform script you can create as many different forms as you wish and they will all function using the one Mailform script.
What follows is a listing of the required and optional HTML tags you should use to create your Mailform. We recommend using only the code you need, and tailoring it to the look and feel of your web-site.
Required TagsThe first tag of your form should look like this:
This line specifies that your form is to be handled by the Mailform script.
The next tag that Mailform requires to function properly appears below. It specifies the email address of the person that will receive the results of the form.
Note: This address must be at the domain name under which Mailform is installed. If you'd like to send the form results to an off-server account you must first create a forwarded email address for the account and specify the recipient to be that forwarding account.
After these two tags are included you can then begin writing the fields for the information you'd like from your users. For example, if you wanted to find out someone's favorite color, you would use an input tag like this:
Optional TagsIn addition to the tags that are required there are quite a few optional tags you can use to change the way the script works:
|Subject|| There are two methods available for
setting the subject of the emails sent by a mailform:
If no subject option is included, then the subject "WWW Form Submission" will appear in the e-mail sent by the mailform.
|Redirect|| The redirect tag allows you to specify
a page the user will be redirected to after successfully completing your
form. To enable the script to do this simply include the following tag:
<input type="hidden" name="redirect" value="http://DomainName.com/return.html">
|Sort|| The sort tag allows you to set the order
in which the results are displayed. To add this feature to your Mailform
include this tag:
<input type="hidden" name="sort" value="order:field1,field2">
|Required Fields|| The ability to require fields is very
helpful when you must gather certain information from your users. To set
certain fields as required include the following tag:
<input type="hidden" name="required" value="field1,field2">
Keep in mind that if you set any fields required, it's a good idea to use the following tag to let your user know what information was not completed.
|Missing Fields Redirect|| The missing fields redirect allows
you to specify a page users will see after attempting to submit your form.
This tag only works in conjunction with the required fields tag and it's
main purpose is to let your users know that they forgot to provide some
required information. The code to incorporate this feature is:
<input type="hidden" name="missing_fields_redirect" value="http://DomainName.com/error.html">
In addition to the above optional tags you can use with Mailform, there are also two special input names you can use to add more functionality to your form.
These two special input names are:
<input type="text" name="realname">
If you use this tag, the email you recieve from the form will appear as if it's from the person that filled out the form.
<input type="text" name="email">
If you use this tag, the email you recieve from the form will have the reply-to address of the person that filled out the form.