Sendmail problem
Hello,
Im having a problem getting my form to work on my server at home. I have a perl script called "cgimail.cgi" placed in "/var/www/cgi-bin/". The form on my webpage is supposed to send the user input to cgimail.cgi and the script is supposed to use Sendmail to email me the form results. I had this all working months ago, but then I did a reinstall of Fedora Core 3 and now I cant get it to work. Mabye I dont have Sendmail configured correctly, or mayby my httpd.conf file isnt configured correctly, or maybe its just a permissions thing. Could you take a look at the code and configuration below and try and help me out.
cgimail.cgi:
#!/usr/bin/perl
use CGI;
# Create the CGI object
my $query = new CGI;
# Output the HTTP header
print $query->header ( );
# Capture the form results
my $email_address = $query->param("Your_Email");
my $comments = $query->param("Message");
my $redirect = $query->param("redirect");
my $subject = $query->param("Subject");
my $from = $query->param("Your_Name");
# Email the form results
open ( MAIL, "| /usr/lib/sendmail -t" );
print MAIL "From: $email_address\n";
print MAIL "Reply-To: $email_address\n";
print MAIL "To: myemailaddress\@myisp.com\n";
print MAIL "Subject: (Form Submission) - $subject\n\n";
print MAIL "From: $from\n\n\n$comments\n";
print MAIL "\n.\n";
close ( MAIL );
# Thank the user
#print "Content-type: text/html\n\n";
print "<html><head>";
print "<META HTTP-EQUIV=\"refresh\" CONTENT=\"1; URL=".$redirect."\">";
print "</head></html>"
My form code:
<form action="/cgi-bin/cgimail.cgi" method="post">
<input type="hidden" name="to" value="">
<table align="center">
<tr>
<td>Your Name:</td><td><input type="text" name="Your_Name"></td>
</tr>
<tr>
<td>Your Email:</td><td><input type="text" name="Your_Email"></td>
</tr>
<tr>
<td>Subject:</td><td><input type="text" name="Subject"></td>
</tr>
<tr>
<td>Attach File:</td><td><input type="file" name="attach_file" size="40"> max 2MB</td>
</tr>
<tr>
<td valign="top">Message:</td><td><textarea name="Message" cols="50" rows="10"></textarea></td>
</tr>
<tr>
<td colspan="2" align="center"><input type="submit" name="Submit" value="Submit"></td>
</tr>
</table>
</form>
Excerpt from httpd.conf:
ScriptAlias /cgi-bin/ "/var/www/cgi-bin/"
#
# "/var/www/cgi-bin" should be changed to whatever your ScriptAliased
# CGI directory exists, if you have that configured.
#
<Directory "/var/www/cgi-bin">
AllowOverride None
Options None
Order allow,deny
Allow from all
</Directory>
The error message is displayed in /var/log/maillog which makes me think it has something to do with the Sendmail configuration. Here is an excerpt from the /var/log/maillog file:
Aug 1 15:19:11 localhost sendmail[3884]: j71KJ6La003884: SYSERR(apache): collect: Cannot write ./dfj71KJ6La003884 (bfcommit, uid=48, gid=51): Permission denied
Aug 1 15:19:11 localhost sendmail[3884]: j71KJ6La003884: from=apache, size=143, class=0, nrcpts=1, relay=apache@localhost
Aug 1 15:19:11 localhost sendmail[3884]: j71KJ6La003884: 0: fl=0x0, mode=10600: FIFO: dev=0/5, ino=16853, nlink=1, u/gid=48/48, size=0
Aug 1 15:19:11 localhost sendmail[3884]: j71KJ6La003884: 1: fl=0x1, mode=10600: FIFO: dev=0/5, ino=16849, nlink=1, u/gid=48/48, size=0
Aug 1 15:19:11 localhost sendmail[3884]: j71KJ6La003884: 2: fl=0x1, mode=10600: FIFO: dev=0/5, ino=16850, nlink=1, u/gid=48/48, size=0
Aug 1 15:19:11 localhost sendmail[3884]: j71KJ6La003884: 3: fl=0x2, mode=140777: SOCK localhost->[[UNIX: /dev/log]]
Aug 1 15:19:11 localhost sendmail[3884]: j71KJ6La003884: 4: fl=0x1, mode=20666: CHR: dev=0/13, ino=1915, nlink=1, u/gid=0/0, size=0
Aug 1 15:19:11 localhost sendmail[3884]: j71KJ6La003884: SYSERR(apache): queueup: cannot create queue file ./qfj71KJ6La003884, euid=48, fd=-1, fp=0x0: Permission denied
Thanks,
Adam
|