LinuxQuestions.org
Welcome to the most active Linux Forum on the web.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Networking
User Name
Password
Linux - Networking This forum is for any issue related to networks or networking.
Routing, network cards, OSI, etc. Anything is fair game.

Notices


Reply
  Search this Thread
Old 08-01-2005, 10:38 PM   #1
xadamz23
LQ Newbie
 
Registered: Aug 2005
Posts: 2

Rep: Reputation: 0
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">&nbsp;&nbsp;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
 
  


Reply



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
Sendmail Problem hansi umayangan Linux - Networking 3 01-17-2005 05:53 AM
Sendmail Problem eggoz Linux - General 2 04-01-2004 01:23 PM
problem processing sendmail.mc to sendmail.cf ...help... lucastic Linux - Networking 1 09-21-2003 10:08 AM
Sendmail problem: sm-client permissions problem d3funct Linux - Software 0 08-12-2003 05:00 PM
little problem with sendmail ... AGAIN MiB_24 Linux - General 6 01-03-2002 07:01 PM

LinuxQuestions.org > Forums > Linux Forums > Linux - Networking

All times are GMT -5. The time now is 10:41 AM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration