sendmail - CGI Script Send Mail error -
hopefully can user has 0 experience cgi coding. prior yesterday, following code working fine when our clients submit orders. yesterday internal server error message appear in browser.
when our hosting company did trouble shooting error log saying:
20130508t200031: www.4printer.com/cgi-bin/mailit.cgi open |/usr/lib/sendmail -t -oi -oem: permission denied @ /home/users/web/b643/ipw.i4printe/public_html/cgi-bin/mailit.cgi line 110
unfortunately not support coding issues.
line 110 of code says this:
$msg->send();
this entire cgi code:
#!/usr/bin/perl # webmaster@qnis.net $date = `/bin/date`; chop($date); # read input read(stdin, $buffer, $env{'content_length'}); # split name-value pairs @pairs = split(/&/, $buffer); if(!($buffer =~ /customer/)){ print <<"(error_msg)"; content-type:text/html <center><font size='4'><b>no data recorded. please use browsers button , try again.
(error_msg) exit; }
$mailprog = "/usr/sbin/sendmail"; $emailinfo = ""; open(mail, "|$mailprog -t") || do{ print "can't open $mailprog!\n"; exit;}; print mail "to: ctsales2\@4printer.com\n"; # print mail "to: jim\@spiderbilt.com\n"; print mail "from: 4printwebform\n"; print mail "subject: california financial printing order form\n\n"; print mail "this form submitted on $date\n\n"; foreach $pair (@pairs) { ($name, $value) = split(/=/, $pair); $value =~ tr/+/ /; $value =~ s/%([a-fa-f0-9][a-fa-f0-9])/pack("c", hex($1))/eg; $name =~ tr/+/ /; $name =~ s/%([a-fa-f0-9][a-fa-f0-9])/pack("c", hex($1))/eg; if ($value eq "submit information") { next; } else { print mail "$name: $value\n\n"; $emailinfo = $emailinfo . "$name: $value<br /><br />"; }
} close (mail);
$title='perl mail demo'; $from= 'info@4printer.com'; $rcvd_cookies = $env{'http_cookie'}; @cookies = split /;/, $rcvd_cookies; foreach $cookie ( @cookies ){ ($key, $val) = split(/=/, $cookie); # splits on first =. $key =~ s/^\s+//; $val =~ s/^\s+//; $key =~ s/\s+$//; $val =~ s/\s+$//; if( $key eq "4printeremail" ){ use uri::escape; $user_id = uri_unescape($val); }
}
## mail header use mime::lite; # sendto email id # create new mime lite based email $msg = mime::lite->new
( subject => "4printer.com confirmation", => 'sales@4printer.com', => $user_id, type => 'text/html', data => '
<tr> <td align="left"> <div width="300"> <font face="arial" size="2"> <p> '.$emailinfo.' </p> <p> order has been received , being processed. <br /><br /> thank order! </p> <br /> <font color="#5485a3"><b>california financial printing</b></font><br /> p.o. box 25755<br /> fresno, ca 93729-5755<br /> 559.454.8414<br /> 800.438.1449 </font> </div> </td> </tr> </table> </td> </tr>
' );
$msg->send(); print <<output; content-type:text/html
output
any advice or input appreciated. thank in advance!
Comments
Post a Comment