NMS FormMail
Managing NMS FormMail
Note: This help
file describes third party software we provide to you through the Control Panel. Third party software titles have self-contained
help files, user forums, or other methods to assist you in maximizing the potential of the feature. This help file describes how
to install/enable, uninstall/disable, and set basic options. We provide links to online help for each third-party application,
if possible.
To Manage FormMail:
Click FormMail, or select AddOns-FormMail. The FormMail window appears.
In the FormMail window, you can perform the following functions:
Installing FormMail:
To Install FormMail:
Important:
If you already have a version of FormMail running on your hosting account, you should make a copy of it before installing
the default FormMail script. If you install the default FormMail script without first making this backup, the default
FormMail script will over-write the old script.This help file discusses the use of the default FormMail script.
- Click FormMail, or select Add-Ons -> FormMail. The FormMail window appears.
- Click Install. The window refreshes with a confirmation message.
- The Install/Un-install status message in the FormMail section displays "FormMail is Installed",
and the Install button is replaced with an UnInstall button. The "Edit FormMail Configuration file" link is
displayed. You can use this link to go to FormMail.
Back to Top
Creating the HTML Form:
If you already have a Form, it can use the default FormMail script. If you do not want to use the default NMS FormMail script,
check to make sure that you are using the correct path to your script, as the default directory is used by the default FormMail
script.
To Create the HTML Form:
- If you do not already have an HTML form, create a new file in your www/htdocs/ directory and create the form. The following code is an example of HTML code for use with the default FormMail. You can adapt the code for your specific use:
- After the form is in place, test it in a Web browser to make sure that it works properly.
Back to Top
Configuring the FormMail:
Use this process to configure FormMail.
To Configure FormMail:
- Click FormMail, or select AddOns-FormMail. The FormMail window appears.
- Click Edit FormMail Configuration file. The File Properties: FormMail window appears.
- Edit the FormMail file in the File Editor, and click Save. A confirmation message appears.
Note: A number of variables are available to use with the FormMail. These variables
alter the way the FormMail script functions. You should use caution when changing the FormMail configuration settings, as
this may cause FormMail to fail in your account environment. For additional information about variables, go to the
Configuration section in the
README document file. For examples using variables, go to the
EXAMPLES file.
Configuring FormMail for Japanese-Language Users:
Note:The default FormMail configuration file is for English language users. Persons
who want to use FormMail to send email messages in Japanese can do so by making simple changes to the FormMail configuration
file.
The basic FormMail user configuration contains the following language parameters:
- $locale = '';
- $charset = 'utf-8';
- $mime=0
This ensures that email messages sent using FormMail can be read by English-speaking users.
Changing the configuration to make FormMail send email messages in Japanese requires that the same three parameters be
changed as follows:
- $locale = 'ja_JP';
- $charset = 'iso-2022-jp';
- $mime = 1;
Setting Up HTML Configuration to Send Email for Japanese-Language Users:
Note:The default HTML configuration file for FormMail is for English language
users. Customers who want to use FormMail to send HTML-formatted email messages in Japanese can do so by making simple
changes to the HTML associated with the FormMail script.
The basic FormMail HTML configuration does not contain specific language parameters:
head
body
form method="post" action="/cgi-bin/formmail/FormMail.pl"
To make FormMail-generated HTML mail Japanese-Language compliant, add the following entry below the "body" entry
in the HTML configuration:
head
body
meta http-equiv="Content-Type" content="text/html;charset=iso-2022-jp"
form method="post" action="/cgi-bin/formmail/FormMail.pl"
Back to Top
Un-installing FormMail:
You can use this feature to un-install FormMail.
To un-install FormMail:
- Click FormMail, or select AddOns-FormMail. The FormMail window appears.
- Click UnInstall. The window refreshes with a confirmation message.
- The Status message now states FormMail is Not Installed.
Back to Top
FormMail Examples
Note This file contains examples of configuration paths for the NMS FormMail
file. This document is intended to be read in conjunction with the
README document file. These documents are
part of the NMS FormMail software package. When the document refers to a configuration path,
the configuration path might not match your account's configuration path.
Configuring FormMail for Japanese-Language Users:
Note:The default FormMail configuration file is for English language users. Persons
who want to use FormMail to send email messages in Japanese can do so by making simple changes to the FormMail configuration
file.
The basic FormMail user configuration contains the following language parameters:
- $locale = '';
- $charset = 'utf-8';
- $mime=0
This ensures that email messages sent using FormMail can be read by English-speaking users.
Changing the configuration to make FormMail send email messages in Japanese requires that the same three parameters be
changed as follows:
- $locale = 'ja_JP';
- $charset = 'iso-2022-jp';
- $mime = 1;
Setting Up HTML Configuration to Send Email for Japanese-Language Users:
Note:The default HTML configuration file for FormMail is for English language
users. Customers who want to use FormMail to send HTML-formatted email messages in Japanese can do so by making simple
changes to the HTML associated with the FormMail script.
The basic FormMail HTML configuration does not contain specific language parameters:
head
body
form method="post" action="/cgi-bin/formmail/FormMail.pl"
To make FormMail-generated HTML mail Japanese-Language compliant, add the following entry below the "body" entry
in the HTML configuration:
head
body
meta http-equiv="Content-Type" content="text/html;charset=iso-2022-jp"
form method="post" action="/cgi-bin/formmail/FormMail.pl"
Default Configuration Section of the FormMail README File:
This is what the default configuration section of the README file of the FormMail script looks like:
# USER CONFIGURATION SECTION
# --------------------------
# Modify these to your own settings. You might have to
# contact your system administrator if you do not run
# your own Web server. If the purpose of these
# parameters seems unclear, please see the README file.
#
BEGIN
{
$DEBUGGING = 1;
$emulate_matts_code= 0;
$secure = 1;
$allow_empty_ref = 1;
$max_recipients = 5;
$mailprog = '/usr/lib/sendmail -oi -t';
$postmaster = '';
@referers = qw(dave.org.uk 209.207.222.64 localhost);
@allow_mail_to = qw(you@your.domain some.one.else@your.domain localhost);
@recipients = ();
%recipient_alias = ();
@valid_ENV = qw(REMOTE_HOST REMOTE_ADDR REMOTE_USER HTTP_USER_AGENT);
$locale = '';
$charset = 'utf-8';
$mime = 0
$date_fmt = '%A, %B %d, %Y at %H:%M:%S';
$style = '/css/nms.css';
$no_content = 0;
$double_spacing = 1;
$wrap_text = 0;
$wrap_style = 1;
$send_confirmation_mail = 0;
$confirmation_text = <<'end_of_confirmation';
From: you@your.com
Subject: form submission
Thank you for your form submission.
END_OF_CONFIRMATION
#
# USER CONFIGURATION << END>>
# ----------------------------
# (no user serviceable parts beyond here)
That can be quite scary to look at, but fortunately many of those settings deal with specialized features most people won't
use, so you'll probably only need to change a few lines.
Everyone will need to ensure that $mailprog, @referers, and @allow_mail_to are set correctly. These
are described in detail in the README file".
It is good practice to also set $postmaster to a valid email address, so that you receive bounce messages if
something goes wrong with the delivery of email.
EXAMPLE 1: A Simple Feedback Form
This example assumes that you have a single feedback form on your home page , where people can enter data, and you want all the results to be mailed to you at your email address.
First, find out the location of the sendmail binary from your system administrator or hosting provider. For this example, assume that the sendmail binary is at /usr/sbin/sendmail.
Now edit the configuration part of FormMail. The lines that need to be changed for this example are:
$mailprog = '/usr/sbin/sendmail -oi -t';
$postmaster = 'fred@your.domain';
@referers = qw(www.your.domain);
@allow_mail_to = qw(your-name@your.domain);
So the configuration section should now look like:
# USER CONFIGURATION SECTION
# --------------------------
# Modify these to your own settings. You might have to
# contact your system administrator if you do not run
# your own Web server. If the purpose of these
# parameters seems unclear, please see the README file.
#
BEGIN
{
$DEBUGGING = 1;
$emulate_matts_code= 0;
$secure = 1;
$allow_empty_ref = 1;
$max_recipients = 5;
$mailprog = '/usr/sbin/sendmail -oi -t';
$postmaster = 'fred@your.domain';
@referers = qw(www.your.domain);
@allow_mail_to = qw(your-name@your.domain);
@recipients = ();
%recipient_alias = ();
@valid_ENV = qw(REMOTE_HOST REMOTE_ADDR REMOTE_USER HTTP_USER_AGENT);
$locale = '';
$charset = 'utf-8';
$mime = 0
$date_fmt = '%A, %B %d, %Y at %H:%M:%S';
$style = '/css/nms.css';
$no_content = 0;
$double_spacing = 1;
$wrap_text = 0;
$wrap_style = 1;
$send_confirmation_mail = 0;
$confirmation_text = <<'end_of_confirmation';
From: you@your.com
Subject: form submission
Thank you for your form submission.
END_OF_CONFIRMATION
#
# USER CONFIGURATION <<END>>
# ----------------------------
# (no user serviceable parts beyond here)
Here is an example of what the HTML source for the form might look like:
<form method="post" action="/cgi-bin/formmail/FormMail.pl">
<table>
<tr>
<td>What is your name ?</td>
<td>input type="text" name="name" /></td>
</tr>
<tr>
<td>What is your favorite animal ?<td>;
<td><input type="text" name="animal" /></td>
</tr>
<tr>
<td colspan="2"><input type="submit" /></td>
</tr>
</table>
</form>
</body>
</html>
Notice that both the FormMail configuration section and the example HTML above refer to a style sheet called
/css/nms.css.
Style sheets are files which tell browsers how to format and display HTML. They're particularly good for scripts like
FormMail because they allow you to alter the look of the HTML that the script produces just by altering the style sheet,
with no need to edit the guts of the script. For more information on style sheets, go to
http://www.w3.org/Style/CSS/.
If you do not want to use style sheets on your site, then you can prevent FormMail from using them by changing
$style = '/css/nms.css';
to
$style = '';
in the configuration section of the script.
EXAMPLE 2: Setting the Email Subject
If you test the example above, you'll notice that the email has the subject "WWW Form Submission". This example
extends EXAMPLE 1: A Simple Feedback Form by adding a customized email subject line.
You do not have to make any other changes FormMail. We just add an extra line to the HTML form. The new line is:
<input type="hidden" name="subject" value="Favorite Animal" />
With this line added, the HTML now looks like:
<?xml version="1.0" encoding="utf-8"?>
<?$mime = 0?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head> <title>What is your favorite animal ?</title>
<link rel="stylesheet" type="text/css" href="/css/nms.css" />
</head>
<body>
<form method="post" action="/cgi-bin/formmail/FormMail.pl">
<input type="hidden" name="subject" value="Favorite Animal" />
<table>
<tr>
<<td>What is your name ?</td>
<td><input type="text" name="name" /></td>
</tr>
<tr>
<td>What is your favorite animal ?</td>
<td><input type="text" name="animal" /></td>
</tr>
<tr>
<td colspan="2"><input type="submit" />></td>
</tr>
</table>
</form>
</body>
</html>
Since the subject is set in the HTML form rather than in the script itself, you can have many different forms on your site,
each using a different subject for the email.
EXAMPLE 3: Copies to Multiple Recipients
This example extends EXAMPLE 2: Setting the Email Subject by sending a copy of the email to each of two
different addresses. In this example you want the mail sent to both your email address and another email address.
There are two different ways to do this, The most secure approach keeps the email addresses out of the HTML, which is
desirable because it's common practice for the senders of SPAM to collect target email addresses from web sites.
# USER CONFIGURATION SECTION
# --------------------------
# Modify these to your own settings. You might have to
# contact your system administrator if you do not run
# your own Web server. If the purpose of these
# parameters seems unclear, please see the README file.
#
BEGIN
{
$DEBUGGING = 1;
$emulate_matts_code= 0;
$secure = 1;
$allow_empty_ref = 1;
$max_recipients = 5;
$mailprog = '/usr/sbin/sendmail -oi -t';
$postmaster = 'fred@your.domain';
@referers = qw(www.your.domain);
@allow_mail_to = ();
@recipients = ();
%recipient_alias = (
'animals' => 'your-name@your.domain,your-name@somewhere-else.domain',
);
@valid_ENV = qw(REMOTE_HOST REMOTE_ADDR REMOTE_USER HTTP_USER_AGENT);
$locale = '';
$charset = 'utf-8';
$mime = 0
$date_fmt = '%A, %B %d, %Y at %H:%M:%S';
$style = '/css/nms.css';
$no_content = 0;
$double_spacing = 1;
$wrap_text = 0;
$wrap_style = 1;
$send_confirmation_mail = 0;
$confirmation_text = <<'end_of_confirmation';
From: you@your.com
Subject: form submission
Thank you for your form submission. END_OF_CONFIRMATION
#
# USER CONFIGURATION << END>>
# ----------------------------
# (no user serviceable parts beyond here)
The lines that have changed from EXAMPLE 1: A Simple Feedback Form are:
@allow_mail_to = ();
which has changed because the addresses mentioned in %recipient_alias below are automatically allowed, so we do
not need to explicitly allow any addresses, and the single reciept alias line has become 3 lines:
%recipient_alias = (
'animals' => 'your-name@your.domain,your-name@somewhere-else.domain',
)
which tells FormMail that when you tell it that the recipient is "animals" via a hidden form field, you really
mean that the recipients are those two addresses.
The HTML form now has a hidden "recipient" input with a value of "animals":
<?xml version="1.0" encoding="utf-8"?>
<?$mime = 0?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<title>What is your favorite animal ?</title>
<link rel="stylesheet" type="text/css" href="/css/nms.css" />
</head>
<body>
<form method="post" action="/cgi-bin/formmail/FormMail.pl">
<input type="hidden" name="subject" value="Favorite Animal" />
<input type="hidden" name="recipient" value="animals" />
<table>
<tr>
<td>What is your name ?</td>
<td><input type="text" name="name" /<></td>
</tr>
<tr>>
<td>What is your favorite animal ?</td>
<td><input type="text" name="animal" /></td>
</tr>
<tr>
<td colspan="2"><input type="submit" /></td>
</tr>
</table>
</form>
</body>
</html>
EXAMPLE 4: Multiple Forms with Different Recipients
This example adds an additional form to the same site, asking people about their favorite plant. The results of this form
are mailed to a new address, <foo@your.domain>.
An extra line in the %recipient_alias part tells FormMail how to handle a recipient value of "plants":
%recipient_alias =
'animals' => 'your-name@your.domain,your-name@somewhere-else.domain',
'plants' => 'foo@your.domain',
);
Putting all that together, the configuration section of the script is now:
# USER CONFIGURATION SECTION
# --------------------------
# Modify these to your own settings. You might have to
# contact your system administrator if you do not run
# your own Web server. If the purpose of these
# parameters seems unclear, please see the README file.
#
BEGIN
{
$DEBUGGING = 1;
$emulate_matts_code= 0;
$secure = 1;
$allow_empty_ref = 1;
$max_recipients = 5;
$mailprog = '/usr/sbin/sendmail -oi -t';
$postmaster = 'fred@your.domain';
@referers = qw(www.your.domain);
@allow_mail_to = ();
@recipients = ();
%recipient_alias = (
'animals' => 'your-name@your.domain,your-name@somewhere-else.domain',
'plants' => 'foo@your.domain',
);
@valid_ENV = qw(REMOTE_HOST REMOTE_ADDR REMOTE_USER HTTP_USER_AGENT);
$locale = '';
$charset = 'utf-8';
<?$mime = 0?>
$date_fmt = '%A, %B %d, %Y at %H:%M:%S';
$style = '/css/nms.css';
$no_content = 0;
$double_spacing = 1;
$wrap_text = 0;
$wrap_style = 1;
$send_confirmation_mail = 0;
$confirmation_text = <<'end_of_confirmation';
From: you@your.com
Subject: form submission
Thank you for your form submission.
END_OF_CONFIRMATION
#
# USER CONFIGURATION << END>>
# ---------------------------- # (no user serviceable parts beyond here)
Finally, the HTML form for the plants page will look like this:
<?xml version="1.0" encoding="utf-8"?>
<?$mime = 0?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd>
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<title>What is your favorite plant ?</title>
<link rel="stylesheet" type="text/css" href="/css/nms.css" />
</head>
<body>
<form method="post" action="/cgi-bin/formmail/FormMail.pl">
<input type="hidden" name="subject" value="Favorite Plant" />
<input type="hidden" name="recipient" value="plants" />
<table>>
<tr>
<td>What is your name ?</td>
<td>&l;>input type="text" name="name" /></td>
</tr>
<tr>
<td>What is your favorite plant ?</td>
<td><input type="text" name="plant" /></td>
</tr>
<tr>
<td colspan="2"><input type="submit" /></td>
</tr>
</table>
</form>
</body>
</html>
EXAMPLE 5: You Want to be Able to Reply to the Emails
Suppose you have the setup in EXAMPLE 4: Multiple Forms with Different Recipients working, and you
decide that you want to ask the visitors to the Favorite Plant page for their email address in the form, and have
FormMail use the address that they enter as the "From:" address for the email, so that you can hit "reply"
in your mail software to mail the visitor and strike up a conversation about their favorite plant.
FormMail will do this automatically so long as the input where the visitor sets their email address is given the name
"email". If the input where the visitor gives their name is called "realname" then FormMail will use
this as the comment part of the email address.
You do not have to make any other changes FormMail. We just rename the "name" input to "realname":
<?xml version="1.0" encoding="utf-8"?>
<?$mime = 0?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dgd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<title<What is your favorite plant ?>/title>
<link rel="stylesheet" type="text/css" href="/css/nms.css" />
</head>
<body>
<form method="post" action="/cgi-bin/formmail/FormMail.pl">
<input type="hidden" name="subject" value="Favorite Plant" />
<input type="hidden" name="recipient" value="plants" />
<table>
<tr<
<td>What is your name ?></td>>
<td<>input type="text" name="realname" />>/td>
</tr>
<tr>
<td>What is your email address ?>/td>
<td><input type="text" name="email" /<>/td>
</tr<
<tr<
<td<What is your favorite plant ?></td>
<td<>input type="text" name="plant" /<>/td>
</tr<
<tr<
<td colspan="2"<<input type="submit" /<>/td>
</tr>
</table>
</form>
</body>
</html>
Note:
- There are many more configuration options for FormMail than those used in these examples. See the README file for
details.
- In all these examples, the value of the $DEBUGGING configuration variable is set to 1. Change it to 0 once
you have finished setting up your forms, in order to restrict the amount of information that a malicious person attacking
your site can obtain.
- In all these examples, the value of the $max_recipients configuration variable is set to the default of 5.
Since the largest number of recipients used in any single form in these examples is 2, it could be reduced to 2 and all
of the examples would continue to work.
Back to Top

|