CGI-BIN Formmail

Recentally I moved my website from one host to another as well as changed the domain name.  After doing this my contact forms no longer worked.  I have now experience with cgi and have no clue where to start.  Any ideas...???

Thanks for your time,
Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

Ioannes-GillAuthor Commented:
This is what I get when a form is submitted:


You don't have permission to access /cgi-bin/formmail/ on this server.

Apache/2.0.46 (Red Hat) Server at Port 80
can you tell us the contents of your cgi-bin/formmail folder (i.e. list the file names)? I have a feeling that you have some file called index in there, to which your form should point (rather than simply cgi-bin/formmail/).
Ioannes-GillAuthor Commented:
There is nothing in the transferred or originating cgi-bin/formmail folder.  However, there are several files in the main cgi folder.  
They are as follows:

  Formmail folder
  online folder
  SiteSparks folder
  htsearch - ht digger file
  insecure.formmail - formmail file
Cloud Class® Course: Microsoft Exchange Server

The MCTS: Microsoft Exchange Server 2010 certification validates your skills in supporting the maintenance and administration of the Exchange servers in an enterprise environment. Learn everything you need to know with this course.

The problem is in your html code...

replace this line in your contact.html

 <form method="POST"action="./cgi-bin/formmail"name="contactform">

with this:

 <form method="POST" action="/cgi-bin/FormMail.cgi" name="contactform">
Replace this in download.html

<form name="sampledownload" method="POST" action="../cgi-bin/formmail">

<form name="sampledownload" method="POST" action="/cgi-bin/FormMail.cgi">
Ioannes-GillAuthor Commented:
Well...  That at least gave me a new error....  Here it is...

Internal Server Error

The server encountered an internal error or misconfiguration and was unable to complete your request.

Please contact the server administrator, and inform them of the time the error occurred, and anything you might have done that may have caused the error.

More information about this error may be available in the server error log.

Apache/2.0.46 (Red Hat) Server at Port 80

Thanks for your help though..
Please include server error log...
Check this line in FormMail.cgi

@referers = ('http://****.com');

Maybe ****.com is your old domain name, replace it with your new domain name.

Also, make sure the script is 755 executable.
Ioannes-GillAuthor Commented:
As far as the error log... I'm not sure if you'd want me to post that many characters here..  

The FormMail.cgi file is blank...  Previously, I thought this was normal as it appeared this way when the form worked before the move.
Should something like this be here:

<form method="POST"action="./cgi-bin/FormMail.cgi"name="contactform">
        <input type="hidden" name="recipient"value="">
        <input type="hidden" name="subject"value="GG CONTACT MESSAGE">
        <input type="hidden" name="redirect"value="../cthankyou.html">
        <input type="hidden" name="required"value="name,company,email,phone">
        <input type="hidden" name="env_report"value="REMOTE_HOST,REMOTE_USER,HTTP_USER_AGENT">
        <input type="hidden" name="missing_fields_redirect"value="../cfieldmissing.html">
FormMail.cgi is blank? Then there is a problem :) is blank too? If yes, then get formmail script from here:


Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
1) For your error log, it WOULD be helpful if you could post the most recent entries (say the top 50 lines) -- don't worry about posting too many characters.

2) One possible cause of the server error could be incorrect permissions on the files. The permissions should probably be set to 755 or 711 (i.e. owner has all permissions, and everyone else either has read/execute permissions [755], or execute permissions only [711])

3) Another possibility is an error in uploading: Did you make sure to upload all the cgi files as ASCII (not binary)?

4) Another common cause of problems is errors in endline conversions between Unix and Windows. Did you perhaps download the files to a Windows PC (possibly opening and saving some or all of them), and then upload it to your server? Your Unix line endings may have been converted to Windows, which can cause errors when the script compiles.

5) try putting the following line in your script at te top (right below the #!/usr/bin/perl line)

use CGI::Carp qw(fatalsToBrowser);

This will cause perl errors to be shown on the web page, which may give you some hints as to what is going wrong.

6) #5 made me think of yet another possibility -- is your path to perl right at the top of the script? on your old server it may have been slightly different. Some common paths to perl are:


Hope some of that helps you out,
Hi mrielf,
> FormMail.cgi is blank? Then there is a problem :)

> is blank too? If yes, then get formmail script from here:

Just as a helpful suggestion (Points not necessary) - Please DO NOT use the FormMail script from Matt's script archive. It is rife with security problems and obsolete code/style and should not be used. There is a project to update all of the popular MSA scripts which has been undertaken by a group of proficient perl coders called 'NMS'. It is even endorsed by Matt Wright from scriptarchive himself.

You can get the updated NMS formmail from:

Here is Matt Wright's endorsement:

Again, please don't use FormMail from

Oh well gripe, sometimes you try to help a guy out and he just wont listen....
Sadly, it'll be his loss and not mine when some unscrupulous spammer launches the spam campaign of the century from his webserver. :)
But then again, maybe he did do the right thing.. i did say 'no points necessary' :)
Ioannes-GillAuthor Commented:
Actually... I just paid a tech to get it over with in 20 minutes......  They also updated it to the newer version for me.
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Scripting Languages

From novice to tech pro — start learning today.

Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.