homepage Welcome to WebmasterWorld Guest from 54.204.58.87
register, free tools, login, search, pro membership, help, library, announcements, recent posts, open posts,
Become a Pro Member
Visit PubCon.com
Home / Forums Index / Code, Content, and Presentation / Perl Server Side CGI Scripting
Forum Library, Charter, Moderators: coopster & jatar k & phranque

Perl Server Side CGI Scripting Forum

    
Html can not post sendmail?
According to CGI Programming 101, guestbook.cgi is fine, but are not called
cent6




msg:4504826
 11:16 am on Oct 6, 2012 (gmt 0)

Hellow:
According to CGI Programming 101, guestbook.cgi can sendmail to me, but not called by guestbook.html. bellow is my script, could someone give me idea?

========guestbook.cgi===========
#!/usr/bin/perl -wT
use CGI qw(:standard);
use CGI::Carp qw(warningsToBrowser fatalsToBrowser);
use strict;

print header;
print start_html("Results");

$ENV{PATH} = "/usr/sbin";

open (MAIL, "|/usr/sbin/sendmail -oi -t ");

my $recipient = 'centos6test@gmail.com';

print MAIL "To: $recipient\n";

print MAIL "From: centos6test\@gmail.com\n";

print MAIL "Subject: Form Data\n\n";

foreach my $p (param()) {
print MAIL "$p = ", param($p), "\n";
}

close(MAIL);
print <<EndHTML;
<h2>Thank You</h2>
<p>Thank you for writing!</p>
<p>Return to our <a href="/guestbook.html">home page</a></p>
EndHTML

print end_html;

=========guestbook.html===========
<html><head><title>Guestbook Form</title></head>
<body>

<form action="cgi-bin/guestbook.cgi" method="POST">
Your Name: <input type="text" name="name"><br>
Email Address: <input type="text" name="email"><br>
<textarea name="comments" rows="5" cols="60"></textarea><br>
<input type="submit" value="Send">
</form>

</body>
</html>

 

phranque




msg:4504856
 2:03 pm on Oct 6, 2012 (gmt 0)

welcome to WebmasterWorld, cent6!

what response did you get?
what do your server logs tell you?

cent6




msg:4504861
 2:15 pm on Oct 6, 2012 (gmt 0)

Thank you!
In httpd/error_log, I find these message:
sendmail: fatal: chdir /var/spool/postfix: Permission denied: referer: guestbook.html

Could you tell me how to solve this problem?

cent6




msg:4504863
 2:33 pm on Oct 6, 2012 (gmt 0)

Error:

[Sat Oct 06 01:37:16 2012] [error] avahi_entry_group_add_service_strlst("10.0.2.15") failed: Invalid host name
[Sat Oct 06 01:37:16 2012] [notice] Apache/2.2.15 (Unix) DAV/2 PHP/5.3.3 mod_ssl/2.2.15 OpenSSL/1.0.0-fips mod_wsgi/3.2 Python/2.6.6 mod_perl/2.0.4 Perl/v5.10.1 configured -- resuming normal operations
[Sat Oct 06 01:37:29 2012] [error] [client 10.0.2.15] sendmail: fatal: chdir /var/spool/postfix: Permission denied, referer: [10.0.2.15...]

phranque




msg:4505281
 5:20 am on Oct 8, 2012 (gmt 0)

your apache process probably doesn't have permission to send mail.
if you are on centos 6, try this:

/usr/sbin/getsebool httpd_can_sendmail

Global Options:
 top home search open messages active posts  
 

Home / Forums Index / Code, Content, and Presentation / Perl Server Side CGI Scripting
rss feed

All trademarks and copyrights held by respective owners. Member comments are owned by the poster.
Home ¦ Free Tools ¦ Terms of Service ¦ Privacy Policy ¦ Report Problem ¦ About ¦ Library ¦ Newsletter
WebmasterWorld is a Developer Shed Community owned by Jim Boykin.
© Webmaster World 1996-2014 all rights reserved