Neither emails are sent or recieved but it seems to be fine (it loads, processes and redirects without a problem). Any idea what might be causing this?
#!/usr/bin/perl use warnings; use strict; use CGI qw/:standard/; use CGI::Carp qw(fatalsToBrowser); ####################################### # Configuration section # ####################################### my $admin_mail = 'my@email.com'; # change the above to the email address of the administrator my $sendmail = '/usr/lib/sendmail'; # change the above to the location of sendmail on the server my $thank_you_msg = 'Dear Client,\nThank you for contacting Ufly4less. + We aim to respond to all enquires within 1 working day.\n\nRegards,\ +nThe Ufly4less Team\n\n100% committed to finding you cheap fares, everytime!'; # change the above to the thank you message you want to send # your visitors. Add a \n anywhere you want in the message # to create new lines. \n\n would make a double space. my $redirect_url = 'http://www.ufly4less.com/default'; # change the above to the page you want to redirect to ####################################### # Do not edit below this line # ####################################### ######## # This section only initates when the form was submitted ######## if (param()) { print header; my $name = param("name"); my $organisation = param("organisation"); my $address = param("address"); my $town = param("town"); my $county = param("county"); my $postcode = param("postcode"); my $phone = param("phone"); my $email = param("email"); my $message = param("other"); ###### # make sure our required fields are filled out ###### if ($name eq "") { &reqerror("name"); } if ($phone eq "") { &reqerror("phone"); } if ($postcode eq "") { &reqerror("postcode"); } if ($email eq "") { &reqerror("email");} ###### # Email function starts here ###### open(MAIL,"| $sendmail") or die "Can't open $sendmail sendmail beca +use: $!"; print MAIL "To: $admin_mail\n"; print MAIL "From: $email\n"; print MAIL "Subject:Website Enquiry\n"; print MAIL "Contact Name: name\n"; print MAIL "Enquiry Type: $organisation\n"; print MAIL "Address: $address\n"; print MAIL "Town: $town\n"; print MAIL "Postcode: $postcode\n"; print MAIL "County: $county\n"; print MAIL "Phone: $phone\n"; print MAIL "Email: $email\n\n"; print MAIL "Other Details: $message\n"; print MAIL "\n\n"; close(MAIL); open(MAIL,"| $sendmail") or die "Can't open $sendmail sendmail beca +use: $!"; print MAIL "To: $email\n"; print MAIL "From: $admin_mail\n"; print MAIL "Subject:Ufly4Less Website Enquiry\n"; print MAIL "$thank_you_msg \n\n\n"; print MAIL "\n\n"; close(MAIL); ###### # Printout of confirmation page ###### print <<" END"; <HTML> <head> <title></title> <meta http-equiv="refresh" content="1;url=$redirect_url"> </head> <body bgcolor="white" text="black" link="blue" vlink="purple" ali +nk="red"> <p>Thank you for your message. You are now being redirected.</ +p> </body> </HTML> END exit; } ####### # If this section is activated, no form data was submitted ####### else { print header, start_html(); print qq(<font color="red"><b>ERROR:</b></font> This page cannot be + accessed directly. Action cancelled.); exit; } #################### # Error sub routine found below #################### sub reqerror { print header, start_html(); my $error = shift; print qq(<font color="red"><b>ERROR!</b> The field $error was left +blank and is a required field. Please click back to try again.); exit; }
Edit g0n - added readmore tags
In reply to contact form not mailing (urgent!) by coldfingertips
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |