Here is a walk through on setting up the NMS FormMail script.

See Also: Preventing SPAM in FormMail

You will need to download the NMS FormMail script. Make sure to download the "compat" version.

Steps for setting up FormMail

  1. Un-compress the downloaded file and upload the FormMail.pl script to your cgi-bin (you will only need to upload the FormMail.pl file, all other files are documentation).
  2. The next step is to modify the FormMail.pl that is inside your cgi-bin. There are only two lines that you will need to modify. The first is the @referers line. Replace everything inside of the parentheses with your domain, once without the www and then a single space and again with the www. You will need to do this for each domain that you will be sending from. Remember, only one space between each url.
  3. This is where you input any email addresses that the forms will send to. Again, only one space between multiple email addresses. Also, make sure you remove 'localhost' from both the @referers and the @allow_mail_to lines.
  4. Now you can save the FormMail and proceed to modifying your forms.
  5. First, point the action of the FORM tag to the FormMail.pl script inside the cgi-bin:

    Pointing the the contact form to the FormMail.pl

    The following tag is necessary for the form to process the values in the form. Make sure the action points to the correct location on your server. The following is an example.

    <form action="http://www.yourdomain.com/cgi-bin/FormMail.pl" method="post" >

  6. Next, inside of each of your forms you will need to include a few hidden input tags. Copy the code in the text box and paste it into your Contact form. They are detailed below:

    Add the recipient(s) of the email

    This tag will configure the form to send to a specific email or email addresses.

    <input type="hidden" name="recipient" value="you@yourdomain.com,me@yourdomain.com" / >

    Create the subject of the email

    This tag tells the form which email address to send the form to. Just make sure that this email is one of the addresses in your @allow_mail_to field

    <input type="hidden" name="subject" value="From the feedback form" / >

    Redirecting the page to your own "Thank You" page

    This is a optional tag you can input into your form to redirect your form to your own page.

    <input type="hidden" name="redirect" value="http://www.yourdomain.com/thankyou.html" / >

    This is another optional tag to specify where your users will be redirected to after they click the submit button. If you do not include this they will be directed to a very generic looking page created by the FormMail script.

    Important! One last thing that must be performed in order for the FormMail to work is that you must set the permissions on the FormMail.pl to 755. This can be done either inside our control panel from the file manager or from an FTP client like SmartFTP or WS_FTP.

If you are using the file manger you will want to browse to the cgi-bin by clicking on the folder icons for public_html > cgi-bin. Once inside of the cgi-bin click on the text title for FormMail.pl and take notice of the text links that appear in the upper right hand corner of the screen. One of them is Change Permissions. Click this and click all the check boxes for Execute. This will change the numbers at the bottom to 755. Click Change, and your all done.

If you are using an FTP client you will want to browse to the cgi-bin. Then right click on the FormMail.pl and look for an option called CHMOD. This will open a dialog box where you can make the same changes as in our file manager. Make sure execute is turned on for all types of users and that the numbers have changed to 755.

If you have any questions on how to set this up please feel free to send an email to support@inmotionhosting.com.

Did you find this article helpful?

We value your feedback!

Why was this article not helpful? (Check all that apply)
The article is too difficult or too technical to follow.
There is a step or detail missing from the instructions.
The information is incorrect or out-of-date.
It does not resolve the question/problem I have.
How did you find this article?
Please tell us how we can improve this article:
Email Address
Name

new! - Enter your name and email address above and we will post your feedback in the comments on this page!

Related Questions

Here are a few questions related to this article that our customers have asked:
How to set up cgiemail?
FormMail.pl will not send own made thank you page
Would you like to ask a question about this page? If so, click the button below!
Ask a Question
2012-10-16 1:32 pm
Do you have any instruction to setup formmail.pl to support UTF-8? (Asia characters

Thanks.

Mike Zhou
Staff
11,026 Points
2012-10-16 1:58 pm
Hello Mikexzhou,

Thank you for your question regarding using UTF-8 with formmail.

You can update this setting by editing the the line of code in FormMail.pl file pertaining to:
$charset = 'iso-8859-1';

To update it, change 'iso-8859-1' to:
'utf-8'

If you have any further questions, feel free to post them below.
Thank you,

-John-Paul
2014-01-17 1:36 pm
Hello,
It's not working in my case. Everything is working smoothly, I can send e-mails but utf-8 encoding doesn't work. I've changed the following (no result):
$charset = 'utf-8';

=head1 SYNOPSIS
my $cs = CGI::NMS::Charset->new('utf-8');
$self->{CFG} = {

DEBUGGING => 0,
emulate_matts_code => 0,
secure => 1,
locale => '',
charset => 'utf-8',
Thanks
Tom
Staff
9,968 Points
2014-01-17 7:55 pm
Hello Tom,

If you're trying to use utf-8 with FormMail.pl, the only thing you need to change in the FormMail.pl script is just the following line:

$charset = 'utf-8';


In your HTML form itself, you need to specify the charset to also be UTF-8 so that when a web-browser loads the page it already knows that charset should be used for any data submitted from the page.

Just stick this bit of code between your <head> and </head> tags:

<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />


That should do the trick. I went ahead and tested this to verify and it went from sending my email account HTML encoded characters like &#1053; to actually displaying the correct UTF-8 character Н which in that case was a Cyrillic capital H.

If you're still having any issues and you're hosted on our servers, please let us know your domain name either here publicly or by emailing support@inmotionhosting.com so we can take a closer look at all your code, and to look for any errors on the server.

- Jacob
n/a Points
2014-08-12 10:15 pm
Your FormMail.pl is great but when it is used the from email is nobody@carrierzone.com. Why is this? How do I fix this? It must be a setting in your form mail program FormMail.pl. Please email me and let me know at abcdnow@live.com. thanks
Staff
10,022 Points
2014-08-27 11:52 am
To do so, you may simply set a field within your form that looks like this:

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


By creating this input field, a user will be able to specify their email address, and the "From" address will be set to their input.
n/a Points
2014-08-27 11:34 am

I get a confirmation page but do not get email?

$DEBUGGING         = 1;  $emulate_matts_code= 0;  $secure            = 1;  $allow_empty_ref   = 1;  $max_recipients    = 5;  $mailprog          = '/usr/lib/sendmail -oi -t';  $postmaster        = '';  @referers          = qw(ed@trainingindustrialmachinesandequipment.com www.trainingindustrialmachinesandequipment.com);  @allow_mail_to     = qw(ed@trainingindustrialmachinesandequipment.com www.trainingindustrialmachinesandequipment.com);  @recipients        = ();  %recipient_alias   = ();  @valid_ENV         = qw(REMOTE_HOST REMOTE_ADDR REMOTE_USER HTTP_USER_AGENT);  $locale            = '';  $charset           = 'iso-8859-1';  $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;  $address_style     = 0;  $send_confirmation_mail = 0;

I have this FormMail.pl in my cgibin folder.

What am Idoing wrong?

Any help is great.

Ed

Staff
10,022 Points
2014-08-27 11:54 am
Could you provide us with the code of your form that is being submitted?
n/a Points
2014-08-27 2:32 pm

I should have told you after nothing was working but the confirmation page. I changed the FormMail.pl to FormMail.cgi. Nothing changed, but that is why you will see the cgi at the end of FormMail in my action script.

Thanks Ed

n/a Points
2014-08-27 2:12 pm

I get a confirmation page but do not get email?

$DEBUGGING         = 1;  $emulate_matts_code= 0;  $secure            = 1;  $allow_empty_ref   = 1;  $max_recipients    = 5;  $mailprog          = '/usr/lib/sendmail -oi -t';  $postmaster        = '';  @referers          = qw(ed@trainingindustrialmachinesandequipment.com www.trainingindustrialmachinesandequipment.com);  @allow_mail_to     = qw(ed@trainingindustrialmachinesandequipment.com www.trainingindustrialmachinesandequipment.com);  @recipients        = ();  %recipient_alias   = ();  @valid_ENV         = qw(REMOTE_HOST REMOTE_ADDR REMOTE_USER HTTP_USER_AGENT);  $locale            = '';  $charset           = 'iso-8859-1';  $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;  $address_style     = 0;  $send_confirmation_mail = 0;

I have this FormMail.pl in my cgibin folder.

What am Idoing wrong?

Any help is great.

Ed

n/a Points
2014-08-27 2:16 pm
Below is my form code Name:                       Email:                        Comments:          Thanks Ed

I get a confirmation page but do not get email?

$DEBUGGING         = 1;  $emulate_matts_code= 0;  $secure            = 1;  $allow_empty_ref   = 1;  $max_recipients    = 5;  $mailprog          = '/usr/lib/sendmail -oi -t';  $postmaster        = '';  @referers          = qw(ed@trainingindustrialmachinesandequipment.com www.trainingindustrialmachinesandequipment.com);  @allow_mail_to     = qw(ed@trainingindustrialmachinesandequipment.com www.trainingindustrialmachinesandequipment.com);  @recipients        = ();  %recipient_alias   = ();  @valid_ENV         = qw(REMOTE_HOST REMOTE_ADDR REMOTE_USER HTTP_USER_AGENT);  $locale            = '';  $charset           = 'iso-8859-1';  $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;  $address_style     = 0;  $send_confirmation_mail = 0;

I have this FormMail.pl in my cgibin folder.

What am Idoing wrong?

Any help is great.

Ed

n/a Points
2014-08-27 2:34 pm

sorry I dont see the post but I see a duplicate of the first post. I will try again.

<form action="http://www.trainingindustrialmachinesandequipment.com/cgi-bin/FormMail.cgi" method="post" > <input type="hidden" name="recipient" value="ed@trainingindustrialmachinesandequipment.com,itsparts@hotmail.com" /> <input type="hidden" name="subject" value="From the feedback form" /> <input type="hidden" name="redirect" value="http://www.trainingindustrialmachinesandequipment.com/confirmation.html" /> <input type="hidden" name="reset" value="reset"/> Name:&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;    <input type="text" name="name" style="width: 385px"/><br />   <br/> Email:&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;    <input type="text" name="email" style="width: 379px"/><br />   <br/> Comments:&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;     <span class="auto-style4">    <textarea name="comments" class="auto-style5" style="width: 408px; height: 166px" rows="1"></textarea></span><br />   <br />

  <INPUT TYPE="submit" value="Send e-mail"/> <INPUT TYPE="reset" value="reset"/></FORM> 

n/a Points
2014-08-27 2:35 pm

sorry I dont see the post but I see a duplicate of the first post. I will try again.

<form action="http://www.trainingindustrialmachinesandequipment.com/cgi-bin/FormMail.cgi" method="post" > <input type="hidden" name="recipient" value="ed@trainingindustrialmachinesandequipment.com,itsparts@hotmail.com" /> <input type="hidden" name="subject" value="From the feedback form" /> <input type="hidden" name="redirect" value="http://www.trainingindustrialmachinesandequipment.com/confirmation.html" /> <input type="hidden" name="reset" value="reset"/> Name:&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;    <input type="text" name="name" style="width: 385px"/><br />   <br/> Email:&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;    <input type="text" name="email" style="width: 379px"/><br />   <br/> Comments:&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;     <span class="auto-style4">    <textarea name="comments" class="auto-style5" style="width: 408px; height: 166px" rows="1"></textarea></span><br />   <br />

  <INPUT TYPE="submit" value="Send e-mail"/> <INPUT TYPE="reset" value="reset"/></FORM> 

Staff
18,513 Points
2014-08-27 2:48 pm
Hello Ed,

We do appreciate the comments and questions. In the future, if there's anyway that you can consolidate the code to as few posts as possible, then we can reply to them much quicker.

I went through your code with Jeff, and it all appears normal to us. The form looks okay as well. On our servers this script is meant to run as a Perl script, so that might be the issue. You may need to talk with your host to see why the script is running completely. Or at least why the email portion is failing to send you a message. They may need to check the logs to see if they can find any error or indication of the mail being processed at the server.

Apologies that we can't give a direct answer. Hopefully, this does lead you to a solution. Please let us know if you have any further questions or comments.

Regards,
Arnel C.

Post a Comment

Name:
Email Address:
Phone Number:
Comment:
Submit

Please note: Your name and comment will be displayed, but we will not show your email address.

14 Questions & Comments

Post a comment

Back to first comment | top

Need more Help?

Search

Ask the Community!

Get help with your questions from our community of like-minded hosting users and InMotion Hosting Staff.

Current Customers

Chat: Click to Chat Now E-mail: support@InMotionHosting.com
Call: 888-321-HOST (4678) Ticket: Submit a Support Ticket

Not a Customer?

Get web hosting from a company that is here to help. Sign up today!