Site Panel Help User Panel Help Panel Demo's Search Help

Categories

· Show all categories

New Customer FAQs
E-Mail
FTP - File Transfers
Domains
SSH and Telnet
Scripting Languages
Password Protection
MySQL
Stats
Power Tools

· FAQ Home

· EchoEcho+ Support

Power Tools: POWERTOOL: FormMail
WHAT IS A FORM MAILER?
The FormMail is a two step thing:
1: You create a plain HTML page with a form on it.
2: When the form is sent to the formmail script,
it sends out an email with the contents of the form.




************************************************
INSTALLING THE SCRIPT
************************************************
First you need to install the form mail script:

1: Login to the site owner panel.
2: Click "Power tools" in the left menu
3: Click the "Install this powertool" icon to the right of "JackScripts Formmail"
(The icon is a blueish arrow pointing down on a disk)
4: Click "Install" - and you're done!

You can now use this form mailer whenever you need to send the contents of an HTML form to an email address.

You do not need to install multiple form mailers if you have multiple forms. They can all send to the one form mailer you just installed.

The next step is to setup a form that will send to the newly installed formmailer.




************************************************
DEMO ON YOUR SITE:
************************************************
When you install Form Mail - a sample form page, "demo_html.html", is created in the same folder as the script.

You can see the demo file if you go to:

http://yoursite.com/formmail/demo_html.html

(Assuming you installed the from mail in the default "formmail" folder).




************************************************
FORM CONFIGURATION
************************************************

The action of your form needs to point towards formmail.php (obviously).

ie: <FORM ACTION="/formmail/formmail.php" METHOD=POST>




************************************************
REQUIRED FORM FIELD:
************************************************
There is only one form field that you must have in your form, for FormMail.php to work correctly. This is the recipient field.

Field: recipient


Description: This form field allows you to specify to whom you wish for your form results to be mailed. Most likely you will want to configure this option as a hidden form field with a value equal to that of your e-mail address.

Syntax:
<input type=hidden name="recipient" value="email@your.host.com">

For Multiple Recipients seperate the emails with commas (",").


--------------------------------------------------------------------------------




************************************************
OPTIONAL FORM FIELDS:
************************************************

These are the available fields you can use:

recipient (required)
bcc
subject
email
phone_no
fax_no
zip_code
redirect
require
required
attachment
file
file2
env_report
sort
title
missing_fields_redirect
background
bgcolor
text_color
link_color
vlink_color
alink_color
style_sheet
ar_file
(Auto-Responder Option)
ar_subject (Auto-Responder Option)
ar_from (Auto-Responder Option)
multiple selection fields (how-to below)

Below is a detailed explanation of each field:


--------------------------------------------------------------------------------

Field: bcc


Description: This form field allows you to specify to whom you wish for your form results to be Blind Carbon Copied to. Most likely you will want to configure this option as a hidden form field with a value equal to that of your e-mail address.


Syntax:
<input type=hidden name="bcc" value="email@your.host.com, alias@myhost.com">

For Multiple Recipients seperate the emails with commas (",").


--------------------------------------------------------------------------------

Field: subject


Description: The subject field will allow you to specify the subject that you wish to appear in the e-mail that is sent to you after this form has been filled out. If you do not have this option turned on, then the script will default to a message subject: "Form Submission"

Syntax:
<input type=hidden name="subject" value="subject">


--------------------------------------------------------------------------------

Field: email


Description: This form field will allow the user to specify their return e-mail address. If you want to be able to return e-mail to your user, I strongly suggest that you include this form field and allow them to fill it in. This will be put into the From: field of the message you receive. The email address submitted will be checked for validity.

Syntax:
<input type=text name="email">


--------------------------------------------------------------------------------

Field: phone_no


Description: This form field will allow the user to specify a phone number.
The phone number submitted will be checked for validity and must match one of the following formats.

123.123.1234
123-123-1234
(123)123.1234
(123)123-1234
etc..

Syntax:
<input type=text name="phone_no">


--------------------------------------------------------------------------------

Field: fax_no


Description: This form field will allow the user to specify a fax number.
The fax number submitted will be checked for validity and must match one of the following formats.

123.123.1234
123-123-1234
(123)123.1234
(123)123-1234
etc..

Syntax:
<input type=text name="fax_no">


--------------------------------------------------------------------------------

Field: zip_code


Description: This form field will allow the user to specify a zip code. The zip code submitted will be checked for basic validity and must match one of the following formats.

12345
12345-1234
A1B 2C3 (for candians :P)
Note: Only Versions 3.0 and higher support Canadian Postal Codes.

Syntax:
<input type=text name="zip_code">


--------------------------------------------------------------------------------

Field: redirect


Description: If you wish to redirect the user to a different URL, rather than having them see the default response to the fill-out form, you can use this hidden variable to send them to a pre-made HTML page or as another form type to let the user decide.

Syntax: To choose the URL they will end up at:
<input type=hidden name="redirect" value="http://your.host.com/to/ file.html">

To allow the user to specify a URL they wish to travel to once the form is filled out:
<input type=text name="redirect" value="http://">

Other options include drop down menus and radios etc..


--------------------------------------------------------------------------------

Field: require


Description: You can now require for certain fields in your form to be filled in before the user can successfully submit the form. Simply place all field names that you want to be mandatory into this field. If the required fields are not filled in, the user will be notified of what they need to fill in, and a link back to the form they just submitted will be provided.

(To use a customized error page, see missing_fields_redirect)

Syntax: If you want to require that they fill in the email and phone fields in your form, so that you can reach them once you have received the mail, use a syntax like:
<input type=hidden name="require" value="email,phone_no">

You can use this on any field.


--------------------------------------------------------------------------------

Field: required


Description: Required is an alias for require,

Because I was unaware that Matt Wright used "required" for the same purpose I originally used "require". A lot of people had problems with that, so I have made an alias. (Note: this is only in Version 3.0 or higher.)

see: require

Syntax:
<input type=hidden name="required" value="email,phone_no">


--------------------------------------------------------------------------------

Field: attachment


Description: Allows the user attach a file to the email sent by Formmail.php.

REQUIRED

If you are using the attachment option it is crucial to include the ENCTYPE="multipart/form-data" in the form field.
Example Here

RECOMMENDED

MAX_FILE_SIZE - (case sensitive) hidden field must precede the file input field and it's value is the maximum filesize accepted. The value is in bytes.

Note: This feature was added in version 5.0

Syntax:
<input type="hidden" name="MAX_FILE_SIZE" value="1000000">

<input type="file" name="attachment">


--------------------------------------------------------------------------------

Field: file


Description: Allows the user to upload a file to a path of your specification.

REQUIRED

If you are using the file option it is crucial to include the ENCTYPE="multipart/form-data" in the form field.
Example Here

path_to_file - This is the path which the file will be uploaded to. Must be a direct path to your directory. ie: "/www/yourname/filedir/"

RECOMMENDED

MAX_FILE_SIZE - (case sensitive) hidden field must precede the file input field and it's value is the maximum filesize accepted. The value is in bytes.

Syntax:
<input type="hidden" name="MAX_FILE_SIZE" value="1000000">

<input type="hidden" name="path_to_file" value="/www/dir_where_file_goes/">

<input type="file" name="file">


--------------------------------------------------------------------------------

Field: file2


Description: I received a lot of email asking how to handle additional file uploads, I added "file2" to show how easy it is:
Keep the same syntax as above, but append a "2" to the end of the file.

Advanced: to add addtional files copy the php functions (below) that handle the file upload for file2 and and change the "2"s to a "3" or anything else.


--------------------------------------------------------------------------------

Field: sort


Description: This field allows you to choose the order in which you wish for your variables to appear in the email that Formmail.php generates. You can choose to have the field sorted alphabetically or specify a set order in which you want the fields to appear in your mail message. By leaving this field out, the order will simply default to the order in which the browsers sends the information to the script (which is usually the exact same order as they appeared in the form.) When sorting by a set order of fields, you should include the phrase "order:" as the first part of your value for the sort field, and then follow that with the field names you want to be listed in the email message, separated by commas.
Note: This feature was added in version 5.0


Syntax: To sort alphabetically:
<input type=hidden name="sort" value="alphabetic">

To sort by a set field order:
<input type=hidden name="sort" value="order:name1,name2,etc...">




--------------------------------------------------------------------------------

Field: env_report


Description: Allows you to have Environment variables included in the e-mail message you receive after a user has filled out your form. Useful if you wish to know what browser they were using, what domain they were coming from or any other attributes associated with environment variables. The following is a short list of valid environment variables that might be useful:

REMOTE_HOST
- Sends the hostname making the request.
REMOTE_ADDR
- Sends the IP address of the remote host making the request.
HTTP_USER_AGENT
- The browser the client is using to send the request.


Syntax: If you wanted to find the remote host and browser sending the request, you would put the following into your form:
<input type=hidden name="env_report" value="REMOTE_HOST, HTTP_USER_AGENT">

Seperate by commas ",".


--------------------------------------------------------------------------------

Field: title


Description: This form field allows you to specify the title and header that will appear on resulting pages if you do not specify a redirect URL.

Syntax: If you wanted a title of 'Feedback Form Results':
<input type=hidden name="title" value="Feedback Form Results">


--------------------------------------------------------------------------------

Field: missing_fields_redirect


Description: This form field allows you to specify a URL that users will be redirected to if there are fields listed in the required form field that are not filled in. This is so you can customize an error page instead of displaying the default.

Note: Version 5.0+ appends a ?error=error message for custom error messages.

Syntax: <input type=hidden name="missing_fields_redirect" value="http://your.host.com/error.html">


--------------------------------------------------------------------------------

Field: background


Description: This form field allow you to specify a background image that will appear if you do not have the redirect field set. This image will appear as the background to the form results page.

Syntax: <input type=hidden name="background" value="http://your.host.xxx/ image.gif">


--------------------------------------------------------------------------------

Field: bgcolor


Description: This form field allow you to specify a background image that will appear if you do not have the redirect field set. This image will appear as the background to the form results page.

Syntax: For a background color of White:
<input type=hidden name="bgcolor" value="#FFFFFF">


--------------------------------------------------------------------------------

Field: text_color


Description: This field works in the same way as bgcolor, except that it will change the color of your text.

Syntax: For a text color of Black:
<input type=hidden name="text_color" value="#000000">


--------------------------------------------------------------------------------

Field: link_color


Description: Changes the color of links on the resulting page. Works in the same way as text_color. Should not be defined if redirect is.

Syntax: For a link color of Red:
<input type=hidden name="link_color" value="#FF0000">


--------------------------------------------------------------------------------

Field: vlink_color


Description: Changes the color of visited links on the resulting page. Works in the same way as link_color. Should not be defined if redirect is.

Syntax: For a visited link color of Blue:
<input type=hidden name="vlink_color" value="#0000FF">


--------------------------------------------------------------------------------

Field: alink_color


Description: Changes the color of visited links on the resulting page. Works in the same way as link_color. Should not be defined if redirect is.

Syntax: For a active link color of Blue:
<input type=hidden name="alink_color" value="#0000FF">


--------------------------------------------------------------------------------

Field: style_sheet


Description: Specifies the path to a style sheet (css) that you would like to include.(Note: this is only in Version 4.0 or higher.)

Syntax: <input type=hidden name="style_sheet" value="style.css">


--------------------------------------------------------------------------------

Auto-Responder Options



Field: ar_file


Description: This optional field should be the path to your a text file which contains your autoresponse text.



Syntax: <input type="hidden" name="ar_file" value="/www/dir_where_file_goes/autoresponder.txt">

Note: This is only supported in Version 5.0 or higher.


--------------------------------------------------------------------------------

Field: ar_subject


Description: The ar_subject field will allow you to specify the subject that you wish to appear in the auto-response e-mail that is sent to the user after this form has been filled out. If you do not have this option turned on, then the script will default to a message subject: "Re: Form Submission"



Syntax: <input type="hidden" name="ar_subject" value="Thank you for your interest">

Note: This is only supported in Version 5.0 or higher.


--------------------------------------------------------------------------------

Field: ar_from


Description: The ar_from field allows you to specify which email address is the auto-response email is sent from.



Syntax: <input type="hidden" name="ar_from" value="webmaster@thisserver.com">

Note: This is only supported in Version 5.0 or higher.


--------------------------------------------------------------------------------

OTHER

To add multiple selection fields simply append a "[]" to the end of a field name.

ie: (for checkboxes)

Option 1: <input type="checkbox" name="multi_field[]" value="option 1"><br>
Option 2: <input type="checkbox" name="multi_field[]" value="option 2"><br>
Option 3: <input type="checkbox" name="multi_field[]" value="option 3"><br>


ie: (for multiple selection fields)

<select name="multi_field[]" size="3" multiple>
<option>Option 1</option>
<option>Option 2</option>
<option>Option 3</option>
<option>Option 4</option>
<option>Option 5</option>
</select>

------------------------------------------
Based on: http://dtheatre.com/scripts/formmail_doc.php

Last update: 12.07.2009, 21:20
Author: EchoEcho Support

printer-friendly version Send to a friend
Show this as PDF file export as XML-File

Average rating: 4.5 from 5 (4 Votes )

Please rate this entry:
completely
useless

1

2

3

4

5
most
valuable
You cannot comment on this entry | Content Overview: Power Tools
Copyright © EchoEchoPlus Hosting