- Download the "compat" version of the NMS FormMail script.
- Un-zip the downloaded file and upload the FormMail.pl script to your cgi-bin folder in your public_html folder.
- Next you will need to modify the FormMail.pl file that was uploaded into your cgi-bin folder. Open the file for editing using either Edit or Code Editor in the cPanel File Manager.
- First, you will need to change the @referers line. Replace everything inside of the parentheses with your domain name, once without the www followed by a single space and again with the www.
@referers = qw(yourdomain.com www.yourdomain.com);
- Next, edit the @allow_mail_to line and replace the existing information with any email addresses that you want the completed form information sent to. If you will be sending a form to multiple recipients or allowing users to choose different recipients, make sure you add each email address with a single space between them.
@allow_mail_to = qw(
Make sure you remove localhost from both the @referers and the @allow_mail_to lines.
After making these two changes, save and close the file.
- Once you have created your contact form, you will need to point the action of the FORM tag to the FormMail.pl script inside the cgi-bin folder:
<form action="http://www.yourdomain.com/cgi-bin/FormMail.pl" method="post">
- You will also need to include a hidden input tag to tell the form which email address to send to.
<input type="hidden" name="recipient" value="
" / >
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 the @allow_mail_to line in FormMail.pl
- There are also two optional tags you can include in your form to specify the subject line of the email that gets delivered to you and what page (URL) users will be redirected to once they have submitted the form:
Specify Email Subject Line:
<input type="hidden" name="subject" value="From the feedback form" / >
You can edit the subject as you like so you can easily recognize emails received from your contact form
Redirect after form submission:
<input type="hidden" name="redirect" value="http://www.yourdomain.com/thankyou.html" / >
Please note in the example above, you will need to create the thankyou.html file. You can also name this file differently (thanks.html for example). Just make sure that name of the file you create matches the name of the file referenced in the tag (e.g. value="http://www.yourdomain.com/thanks.html" / >. This tag is completely optional, if you do not include this tag, users will instead be redirected to the default FormMail Thank You page:
- Finally in order for FormMail to work, make sure the permissions on the FormMail.pl file are set to 755. If this needs to be changed; in the File Manager, right click on the file and select "change permissions."