---
title: "How to Set up FormMail"
description: "In this guide, you can learn how to set up the NMS FormMail script. NOTICE: You will need to download the NMS FormMail script. Make sure to download the \"compat\" package. Set Up FormMail Customize..."
url: https://www.inmotionhosting.com/support/website/how-to-set-up-formmail/
date: 2011-08-26
modified: 2026-04-23
author: "Brad Markle"
categories: ["Website"]
type: post
lang: en
---

# How to Set up FormMail

In this guide, you can learn how to **set up the NMS FormMail script**.

**NOTICE:** You will need to download the [NMS FormMail](https://nms-cgi.sourceforge.net/scripts.shtml) script. Make sure to download the “**compat**” package.

## Set Up FormMail

### Customize FormMail.pl Script

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 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. The line should look like the example below: @referers = qw(example.com www.example.com);
3. Now, modify the **@allow_mail_to** line. Here you specify any email addresses that the forms will send to. Again, only one space between multiple email addresses. Also, make sure you remove the ‘localhost’ entry. The line should look like the example below: @allow_mail_to = qw(webmaster@example.com admin@example.com);
4. Save the FormMail.

### Configure Contact Form

1. 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 your contact form to process the values in the form. Copy the code (below) and paste it into your Contact form’s code. <form action=”https://www.*example.com/cgi-bin/FormMail.pl*” method=”post”> **NOTE:** Be sure to replace *example.com*, with your actual domain name and */cgi-bin/FormMail.pl* with the relative path to the file located on your server.
2. Inside of your form you will also need to include a few hidden *input* tags. Copy the code (below) and paste it into your *contact form’s code*. **Add the recipient(s) of the email:** This tag will configure the form to send to the specified email address(es). <input type=”hidden” name=”recipient” value=”*webmaster@example.com,admin@example.com*” /> **WARNING:** Make sure you replace *webmaster@example.com,admin@example.com* with an email address that is specified in your **@allow_mail_to** field of the **FormMail.pl script**. **Create the subject of the email:** This tag tells the form the subject to create the email with. <input type=”hidden” name=”subject” value=”*From the contact form*” /> **Redirecting the page to your own “Thank You” page** 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. <input type=”hidden” name=”redirect” value=”https://www.*example.com/thankyou.html*” /> **NOTE:** Make sure to replace *example.com/thankyou.html* with the actual page that you create for redirecting your visitor after a submission is made.

### Change File Permissions

**IMPORTANT:** One last thing that must be performed in order for the FormMail to work is that you must [**set the permissions**](/support/) on the *FormMail.pl* file to 755.

#### Change Permissions Using cPanel

1. Log into cPanel.
2. Click on the **File Manager** icon under the *Files* subheader.
3. Browse to the **cgi-bin** by clicking on the folder icons for **public_html > cgi-bin**.
4. Once inside of the *cgi-bin* directory, right-click on the **FormMail.pl** file and click to select **Change Permissions**.
5. Click the checkboxes to ensure that the *User* column has **read, write, and execute** checked and *Group* and *World* should have **read and execute** checked.
6. Click the **Change Permissions** button to save these changes.

#### Change Permissions Using FTP

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

**Congratulations!** Now you have a **FormMail.pl script set up** that you can use to *send email from a contact form on your website*.
