Go Premium for a chance to win a PS4. Enter to Win

x
?
Solved

My formmail script is not working

Posted on 2003-12-01
2
Medium Priority
?
374 Views
Last Modified: 2013-12-25
The form located at:-

http://mypcd-24356-001.dsvr.co.uk/

is not posting correctly????

I have definately got the formmail.pl file in the cgi-bin directory of my server with all the correct read/write/execute permissions set.
I have also used the formmail code for a different site on the same virtual server and it works.

Here is a dump of the first few lines of the formmail.pl


# $mailprog defines the location of your sendmail program on your unix
# system.

$mailprog = '/usr/sbin/sendmail';

# @referers allows forms to be located only on servers which are defined
# in this field.  This fixes a security hole in the last version which
# allowed anyone on any server to use your FormMail script.

@referers = ('mypcd-24356-001.dsvr.co.uk','212.69.200.57');

# $recipient_file is the location of a plain text file listing valid
# recipients of formmail emails.

$recipient_file = '/usr/local/etc/formmail_recipients';

# Done
#############################################################################

use Sys::Hostname;

# Check Referring URL
&check_url;

# Retrieve Date
&get_date;

# Parse Form Contents
&parse_form;

# Check Required Fields
&check_required;

# Check that recipient is valid
&check_valid_recipient;

# Return HTML Page or Redirect User
&return_html;

# Send E-Mail
&send_mail;

sub check_url {

   if ($ENV{'HTTP_REFERER'}) {
      foreach $referer (@referers) {
         if ($ENV{'HTTP_REFERER'} =~ /$referer/i) {
            $check_referer = '1';
          last;
         }
      }
   }
   else {
      $check_referer = '1';
   }
0
Comment
Question by:freedmanrp
2 Comments
 

Author Comment

by:freedmanrp
ID: 9865226
still need help?
0
 
LVL 48

Accepted Solution

by:
Tintin earned 1200 total points
ID: 9889719
Please DO NOT use Matt's formmail.  It is insecure, poorly written and not maintained.

Use the 100% compatible, secure, well written and maintained Formmail version from http://nms-cgi.sourceforge.net/
0

Featured Post

Vote for the Most Valuable Expert

It’s time to recognize experts that go above and beyond with helpful solutions and engagement on site. Choose from the top experts in the Hall of Fame or on the right rail of your favorite topic page. Look for the blue “Nominate” button on their profile to vote.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Making a simple AJAX shopping cart Couple years ago I made my first shopping cart, I used iframe and JavaScript, it was very good at that time, there were no sessions or AJAX, I used cookies on clients machine. Today we have more advanced techno…
It is becoming increasingly popular to have a front-page slider on a web site. Nearly every TV website,  magazine or online news has one on their site, and even some e-commerce sites have one. Today you can use sliders with Joomla, WordPress or …
Learn the basics of strings in Python: declaration, operations, indices, and slicing. Strings are declared with quotations; for example: s = "string": Strings are immutable.: Strings may be concatenated or multiplied using the addition and multiplic…
The viewer will learn the basics of jQuery, including how to invoke it on a web page. Reference your jQuery libraries: (CODE) Include your new external js/jQuery file: (CODE) Write your first lines of code to setup your site for jQuery.: (CODE)
Suggested Courses

885 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question