Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations IamaSherpa on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Script error... help?

Status
Not open for further replies.

frozenpeas

Technical User
Sep 13, 2001
893
CA
Here are the error messages I'm getting in my log:

Code:
[Thu Jul 11 21:57:57 2002] [error] (2)No such file or directory: exec of /home/frozen/html/cgi-bin/mail.cgi failed
[Thu Jul 11 21:57:57 2002] [error] [client 24.72.10.196] Premature end of script headers: /home/frozen/html/cgi-bin/mail.cgi

cgi-bin and mail.cgi are set at 755. I can run other cgi scripts... just not this one. :)

Here is the script:

Code:
#!/usr/bin/perl

require "subparseform.lib";
&Parse_Form;

$Email = $formdata{'sender_email'};
$FirstName = $formdata{'sender_name'};
$Company = $formdata{'Company'};
$ToComments = $formdata{'message'};
$HearAbout = $formdata{'HearAbout'};

$ToEmail = "email\@hotmail.com";
$ToSubject = "Message from website visitor";

$EmailBody = "Sent By: $FirstName\nSenders Email: $Email\nSenders Company: $Company\n\n
Message Sent:\n$ToComments\n\nSender Heard About Site From: $HearAbout\n";

$EmailFooter = "\nThis message was sent by: $FirstName.  If you feel that you 
recieved this e-mail by accident please contact us at [URL unfurl="true"]www.yourSite.com";[/URL]

$Message = $EmailBody.$EmailFooter;

open (MAIL, "|/usr/sbin/sendmail -t") || &ErrorMessage;
print MAIL "To: $ToEmail \nFrom: $Email\n";
print MAIL "Subject: $ToSubject\n";
print MAIL "$Message\n";
close (MAIL);

print "Content-type: text/html\n\n";
print "_root.Mail.EmailStatus=Complete - Your mail has been sent";

sub ErrorMessage {
print "Content-type: text/html\n\n";
print "_root.Mail.EmailStatus=Connection Failed Please Check the path to the Mail program";
exit; }

Can anyone see what's wrong? Thanks.
 
Your code is dying because it either can not find 'mail.cgi' or it is finding it but can not execute it.
Check paths and permissions, make sure the execute bit is set.
Remember, CGI is running in the web daemon's environment, not a normal user environment. 'hope this helps

If you are new to Tek-Tips, please use descriptive titles, check the FAQs, and beware the evil typo.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top