/usr/sbin/sendmail: Bad file descriptor
where can I find out where is sendmail? I put it as /usr/sbin/sendmail but when I test it I got an error said " /usr/sbin/sendmail: Bad file descriptor ". Or I have to check with my hosting company? Can anybody sport anything wrong of my code?here is my code
#!/usr/bin/perl -w
print "Content-type: text/html\n\n";
print "thank you !\n";
$sendmail = '/usr/sbin/sendmail'; # where is sendmail?
$recipient = "hoachen\@hotmail.com"; # who gets the form data?
print "\n\nwhat is this $sendmailfor sendmail\n\n";
print "\n\nthis is a $recipient for recipient\n\n";
use CGI;
$query = new CGI;
$mail_body = '';
foreach $field (sort ($query->param)) {
foreach $value ($query->param($field)) {
$mail_body .= "$field: $value\n";
}
}
if ($email = $query->param('07_email')) {
if ($name = $query->param('01_name')) {
$name =~ s/"//g; # lose any double-quotes in name
$sender = "\"$name\" <$email>";
} else {
$sender = "$email";
}
}
open(MAIL, "|$sendmail -oi -t") or die "Can't open pipe to $sendmail: $!\n";
print MAIL "To: $recipient\n";
print MAIL "From: $sender\n";
print MAIL "Subject: Sample Web Form Submission\n\n";
print MAIL "$mail_body";
close(MAIL) or die "Can't close pipe to $sendmail: $!\n";