Link to home
Start Free TrialLog in
Avatar of sara_bellum
sara_bellumFlag for United States of America

asked on

Squirrelmail fails to connect to sendmail (or vice versa)

I have been using sendmail on RHES for some time, and recently configured it for use with procmail and spamassassin, so  junk mail is way down :)  However now Squirrelmail doesn't work.  It passes the config test, and users can log into their inbox and view files that were stored in /home/user/mail, but can't send or receive mail.  
I can see their mail in /var/spool/mail/user, but when I select "Check Mail" in the Squirrelmail window for that user, nothing happens, and there are no errors in the maillog.  When trying to send mail from Squirrelmail, users get this error:
Email delivery error
Server replied: 127 Can't execute command '/usr/sbin/sendmail -i -t -fuser@mydomain.com'.
Again,  the mail log only shows:
# imapd[pid_number]: imap service init from 127.0.0.1
How do I fix this?
Avatar of sara_bellum
sara_bellum
Flag of United States of America image

ASKER

I removed .procmailrc from the folders of users who use IMAP/squirrelmail, and their mail is now delivered to /home/user/mail from /var/spool/mail, with /etc/procmailrc still directing their mail thru spamassassin.
However users still cannot send mail from squirrelmail.  I've telneted into the imap server on port 143 and checked the inbox, all seems ok (TLS is not running).
If there's a lock file somewhere I couldn't find it.  Checked ps -ef |grep sendmail and all looks ok:
smmsp     6551     1  0 Nov08 ?        00:00:00 sendmail: Queue runner@01:00:00 for /var/spool/clientmqueue
root      6554     1  0 Nov08 ?        00:00:00 sendmail: accepting connections
The reason squirrelmail can't connect to sendmail may be that sendmail is being held up by another process.  I was experimenting with a script a few days ago (I know I should never do this for a server connected to the Internet) and since then my mail log has been showing lots of these errors:
myserver sendmail[27339]: kA9KiI3k009140: to=<yourname@example.com>                                          , ctladdr=<apache@myserver.mydomain.com> (48/48), delay=3+12:13:09, xdelay=00:00:00, mailer=esmtp, pri=7860345, relay=example.com., dsn=4.0.0, stat=Deferred: Connection timed out with example.com.
At one point I also caught this while checking for sendmail pids:
root     27252 27251  0 23:45 ?        00:00:00 sendmail: ./kA9Kcgcj009062 example.com.: user open
How do I get rid of this problem?
Avatar of jar3817
jar3817

"I was experimenting with a script a few days ago..."

What did this script do? What exactly did you change to implement procmail and spamassassin? If you undo all the changes you made, does the system function as it did before you started?  
It's a form-to-mail script, where your html form input is sent to your email address:
<?
$email = $_REQUEST['email'] ;
$message = $_REQUEST['message'] ;

mail( "yourname@example.com", "Feedback Form Results", $message, "From: $email" );
header( "Location: http://yoursite@yourdomain.com/thanks.htm" );
?>
The apache maillog entries may be unrelated to the squirrelmail problem, since squirrelmail is now running correctly, after tweaking php.ini and httpd.conf.  Probably in the course of trying to secure my server after recent attacks (which include the above), I got the error.  Now if I can stop apache from sending these unsolicited emails, I can close this out, thanks.


"Now if I can stop apache from sending these unsolicited emails, I can close this out, thanks."

What do you mean stop apache from sending unsolicited emails? You're receiving email from spammers from your form-to-mail or are they able to relay spam to outside addresses using apache?
The form to mail is no longer posted, I took it offline (outside of web root) as soon as I saw the problem.  
However sendmail is still trying to deliver mail from apache, four times every hour:
Nov 14 01:47:25 myserver sendmail[29392]: kA9Ke4Z1009118: to=<yourname@example.com>, ctladdr=<apache@myserver.mydomain.com> (48/48), delay=4+14:07:15, xdelay=00:00:00, mailer=esmtp, pri=10200343, relay=example.com., dsn=4.0.0, stat=Deferred: Connection timed out with example.com.
To stop this from running I added this line to /etc/mail/access:
example.com      55O Error message
and hashed it to access.db, restarted sendmail, but no difference (I thought this was supposed to tell sendmail not to use example.com as a relay, but the rule either isn't recognized or it isn't relevant to the problem)
I also thought that sendmail gives up trying to deliver mail after 3 days or so, but this has been going on since 9 Nov - six days.  
I received 4 'returned mail' notifications in my inbox, all addressed to 'yourname@example.com', confirming original message received 9 Nov, and 'could not deliver for the past  5 days.' These must have been in /var/spool/mqueue all along, and all I had to do was delete them from there.  I removed a bunch of old files from that queue, so I'll be checking it more often for errors.  Since the error does not appear in my maillog for the past couple of hours, I'm assuming that was the problem.
If you have something important to add or correct I'll award points.  Otherwise, I'll request closeout.  
ASKER CERTIFIED SOLUTION
Avatar of kodiakbear
kodiakbear

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial