Recently, support for formmail.pl on the server level has been discontinued. The solution is to use a secure replacement within your account. If you want our staff to install it for you, we can do so but there may be a minimum charge.
Download the zip file from this page: http://nms-cgi.sourceforge.net/scripts.shtml
OR, here’s the direct download link: http://nms-cgi.sourceforge.net/formmail_compat-3.14c1.zip
- Un-compress the downloaded file.
- The next step is to modify the FormMail.pl file. 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.
- The second line you will need to edit in the FormMail.pl script is the @allow_mail_to lines. 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.
- Upload the FormMail.pl script to your /public_html/cgi-bin directory (you will only need to upload the FormMail.pl file, all other files are documentation). You can use the FileManager tool in your control panel for this or FTP if you’re familiar with it.
- Now you can save the FormMail and proceed to modifying your website forms. First, it is necessary to point the action of the FORM tag to the FormMail.pl script inside the cgi-bin. The following is an example.
<form action="/cgi-bin/formmail.pl" method="POST" name="form1">
- Next, inside of each of your forms you will need to include a few hidden input tags. 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. 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="recipient" value="yourname@yourdomain.com" />
- Create the subject of the email
<input name="subject" size="80" type="text" placeholder="Technical Support Request" />
- 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. This is an 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://yourdomain.com/thank-you.html" />
- 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 tool or from an FTP client.If you are using the file manager 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.
At minimum your form requires the following once your specify the email address.
<FORM NAME="test" ACTION="/cgi-bin/FormMail.pl" METHOD="POST"> <INPUT TYPE="hidden" NAME="recipient" VALUE="email@domain.com"> Enter your Name: <INPUT TYPE="text" NAME="name"><br> <INPUT TYPE="SUBMIT"> </FORM>
Here’s a slightly more elaborate version.
<FORM NAME="test" ACTION="/cgi-bin/formmail.pl" METHOD="POST"> <INPUT TYPE="hidden" NAME="recipient" VALUE="email@domain.com"> <INPUT TYPE="hidden" NAME="subject" VALUE="This is a test form"> <INPUT TYPE="hidden" NAME="redirect" VALUE="http://domain.com/redirect.html"> <INPUT TYPE="hidden" NAME="required" VALUE="email,realname"> E-Mail Address: <INPUT TYPE="text" NAME="email"><br> Name: <INPUT TYPE="text" NAME="realname"><br> Favorite Color: <INPUT TYPE="text" NAME="color"><br> <INPUT TYPE="SUBMIT"> </FORM>
You can prevent spam but user RECaptcha: https://developers.google.com/recaptcha/old/docs/formmail