Hi, I'm new to this forums and I have made Matt's FormMail.pl work on other sites before, but when it came down to adding reCAPTCHA and new fields, I just get a 500 Internal Server Error. I've followed the directions placed on the reCAPTCHA site, I'm sure it's something to do with the syntax or the lines that I added and removed.

I've even tried using NMS FormMail Version 3.14c1, which I had to improvise adding the reCAPTCHA code. But I'm still getting a 500 Error.

Can anyone help me with this please?

Matt's FormMail Code:
Code:
#!/usr/bin/perl
##############################################################################
# FormMail                        Version 1.92                               #
# Copyright 1995-2002 Matt Wright mattw@scriptarchive.com                    #
# Created 06/09/95                Last Modified 04/21/02                     #
# Matt's Script Archive, Inc.:    http://www.scriptarchive.com/              #
##############################################################################
# COPYRIGHT NOTICE                                                           #
# Copyright 1995-2002 Matthew M. Wright  All Rights Reserved.                #
#                                                                            #
# FormMail may be used and modified free of charge by anyone so long as this #
# copyright notice and the comments above remain intact.  By using this      #
# code you agree to indemnify Matthew M. Wright from any liability that      #
# might arise from its use.                                                  #
#                                                                            #
# Selling the code for this program without prior written consent is         #
# expressly forbidden.  In other words, please ask first before you try and  #
# make money off of my program.                                              #
#                                                                            #
# Obtain permission before redistributing this software over the Internet or #
# in any other medium. In all cases copyright and header must remain intact. #
##############################################################################
# ACCESS CONTROL FIX: Peter D. Thompson Yezek                                #
#                     http://www.securityfocus.com/archive/1/62033           #
##############################################################################
# Define Variables                                                           #
#      Detailed Information Found In README File.                            #

# $mailprog defines the location of your sendmail program on your unix       #
# system. The flags -i and -t should be passed to sendmail in order to       #
# have it ignore single dots on a line and to read message for recipients    #

$mailprog = '/usr/sbin/sendmail -i -t';

# @referers allows forms to be located only on servers which are defined     #
# in this field.  This security fix from the last version which allowed      #
# anyone on any server to use your FormMail script on their web site.        #

@referers = ('singaporean-directory.com','203.116.66.44');

# @recipients defines the e-mail addresses or domain names that e-mail can   #
# be sent to.  This must be filled in correctly to prevent SPAM and allow    #
# valid addresses to receive e-mail.  Read the documentation to find out how #
# this variable works!!!  It is EXTREMELY IMPORTANT.                         #
@recipients = &fill_recipients(@referers);

# ACCESS CONTROL FIX: Peter D. Thompson Yezek                                #
# @valid_ENV allows the sysadmin to define what environment variables can    #
# be reported via the env_report directive.  This was implemented to fix     #
# the problem reported at http://www.securityfocus.com/bid/1187              #

@valid_ENV = ('REMOTE_HOST','REMOTE_ADDR','REMOTE_USER','HTTP_USER_AGENT');

# Done                                                                       #
##############################################################################
use LWP::UserAgent;

# Check Referring URL
&check_url;

# Retrieve Date
&get_date;

# Parse Form Contents
&parse_form;

# Check Required Fields
&check_required;

# Check the captcha challenge and response.
&check_captcha;

# Send E-Mail
&send_mail;

# Return HTML Page or Redirect User
&return_html;

##############################################################################
# Check the CAPTCHA response via the reCAPTCHA service.
sub check_captcha {

      my $ua = LWP::UserAgent->new();
      my $result=$ua->post(
      'http://api-verify.recaptcha.net/verify',
      {
          privatekey => 'your_private_key',
          remoteip   => $ENV{'REMOTE_ADDR'},
          challenge  => $Form{'recaptcha_challenge_field'},
          response   => $Form{'recaptcha_response_field'}
      });

      if ( $result->is_success && $result->content =~ /^true/) {
              return;
      } else {
              &error('captcha_failed');
      }
}

# NOTE rev1.91: This function is no longer intended to stop abuse, that      #
......
}

sub parse_form {

    # Define the configuration associative array.                            #
    %Config = ('recipient','',          'subject','',
               'EMAIL','',              'NAME','',
               'TITLE','',              'URL','',
               'DESCRIPTION','',        'CATEGORY','',
               'RECIPROCAL','',		'missing_fields_redirect','',         
               'redirect','',           'bgcolor','',
               'background','',         'link_color','',
               'vlink_color','',        'text_color','',
               'alink_color','',        'title','',
               'sort','',               'print_config','',
               'required','',           'env_report','',
               'return_link_title','',  'return_link_url','',
               'print_blank_fields','');

    # Determine the form's REQUEST_METHOD (GET or POST) and split the form   #
......
(END ERROR HTML)
        }
    exit;
}
Looks like there's not enough space for the NMS FormMail Code, so I'll place it in the next reply.

Thanks in advance, I really appreciate it.