LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - Software (https://www.linuxquestions.org/questions/linux-software-2/)
-   -   Email nightmares (sendmail and the local mailer) (https://www.linuxquestions.org/questions/linux-software-2/email-nightmares-sendmail-and-the-local-mailer-529500/)

Elric of Grans 02-15-2007 11:30 PM

Email nightmares (sendmail and the local mailer)
 
I had an email system configured and working quite some time ago on a system that almost never receives email. As a result, I have only recently noticed that it was not receiving new mail, so I am not sure when or why it stopped working. There have been numerous software updates since I last checked it, so it likely lies in there somewhere.

As far as I can see, fetchmail is having no difficulty picking up email from the server, and it seems like it passes it onto sendmail without any issues (/var/spool/mail/mqueue/ gets a new directory every time I send a test email, which suggests sendmail is acting normally). Trying sendmail -v -q results in an error relating to the local mailer (maildrop):
Code:

Running /var/spool/mqueue/A015n3S6001690 (sequence 1 of 6)                     
/etc/mail/aliases: 26 aliases, longest 10 bytes, 287 bytes total               
aliased to root                                                               
root... Connecting to local...                                                 
root... Deferred: local mailer (/usr/bin/maildrop) exited with EX_TEMPFAIL     
                                                                               
Running /var/spool/mqueue/A0150HK8001669 (sequence 2 of 6)                     
<sysadmin@localhost>... Connecting to local...                                 
<sysadmin@localhost>... Deferred: local mailer (/usr/bin/maildrop) exited with EX_TEMPFAIL                                                                     
                                                                               
Running /var/spool/mqueue/A013d3W5001652 (sequence 3 of 6)                     
root... aliased to root                                                       
root... Connecting to local...                                                 
root... Deferred: local mailer (/usr/bin/maildrop) exited with EX_TEMPFAIL     
                                                                               
Running /var/spool/mqueue/A013p1K9001657 (sequence 4 of 6)                     
root... aliased to root                                                       
root... Connecting to local...                                                 
root... Deferred: local mailer (/usr/bin/maildrop) exited with EX_TEMPFAIL     
                                                                               
Running /var/spool/mqueue/A011ciqG001621 (sequence 5 of 6)                     
<root@osk.capgo.com>... aliased to root                                       
<root@osk.capgo.com>... Connecting to local...                                 
<root@osk.capgo.com>... Deferred: local mailer (/usr/bin/maildrop) exited with EX_TEMPFAIL                                                                     
Warning: could not send message for past 4 hours                               
<postmaster@osk.capgo.com>... aliased to root                                 
root... aliased to root                                                       
root... Connecting to local...                                                 
root... Deferred: local mailer (/usr/bin/maildrop) exited with EX_TEMPFAIL     
                                                                               
Running /var/spool/mqueue/A010UfNM001627 (sequence 6 of 6)                     
<guru@localhost>... Connecting to local...                                     
<guru@localhost>... Deferred: local mailer (/usr/bin/maildrop) exited with EX_TEMPFAIL

Now, for testing, I make a mock email in a text file, and tried sending it with the following:
Code:

cat test.email | maildrop -V 5 -d root
Which results in the following:
Code:

maildrop: Changing to /                                                       
Message start at 61 bytes, envelope sender=matthew@localhost.localdomain       
/etc/maildroprc(1): DEFAULT="/var/spool/mail/root"                             
/etc/maildroprc(2): SHELL="/bin/sh"                                           
/etc/maildroprc(3): SENDMAIL="/usr/sbin/sendmail"                             
/etc/maildroprc(5): Evaluating IF condition.                                   
Matching /^X-Virus-Flag: YES/ against Return-Path: <matthew@localhost.localdomain>                                                                             
Not matched.                                                                   
Matching /^X-Virus-Flag: YES/ against X-Original-To: matthew                   
Not matched.                                                                   
Matching /^X-Virus-Flag: YES/ against Delivered-To: matthew@localhost.localdomain                                                                             
Not matched.                                                                   
Matching /^X-Virus-Flag: YES/ against Received: by localhost.localdomain (Postfix, from userid 1000)        id 18A1F1CF3AB; Fri, 16 Feb 2007 14:08:24 +1100 (EST)                                                                             
Not matched.                                                                   
Matching /^X-Virus-Flag: YES/ against To: matthew@localhost.localdomain       
Not matched.                                                                   
Matching /^X-Virus-Flag: YES/ against Subject: hello                           
Not matched.                                                                   
Matching /^X-Virus-Flag: YES/ against Message-Id: <20070216030824.18A1F1CF3AB@localhost.localdomain>                                                           
Not matched.                                                                   
Matching /^X-Virus-Flag: YES/ against Date: Fri, 16 Feb 2007 14:08:24 +1100 (EST)                                                                             
Not matched.                                                                   
Matching /^X-Virus-Flag: YES/ against From: matthew@localhost.localdomain (Matthew Percival)                                                                   
Not matched.                                                                   
/etc/maildroprc(5): Search of ^X-Virus-Flag: YES = 0                           
/etc/maildroprc(5): IF evaluated, result=0                                     
/etc/maildroprc(11): Evaluating IF condition.                                 
Matching /^X-Spam-Flag: YES/ against Return-Path: <matthew@localhost.localdomain>                                                                             
Not matched.                                                                   
Matching /^X-Spam-Flag: YES/ against X-Original-To: matthew                   
Not matched.                                                                   
Matching /^X-Spam-Flag: YES/ against Delivered-To: matthew@localhost.localdomain
Not matched.                                                                   
Matching /^X-Spam-Flag: YES/ against Received: by localhost.localdomain (Postfix, from userid 1000)        id 18A1F1CF3AB; Fri, 16 Feb 2007 14:08:24 +1100 (EST)
Not matched.                                                                   
Matching /^X-Spam-Flag: YES/ against To: matthew@localhost.localdomain         
Not matched.                                                                   
Matching /^X-Spam-Flag: YES/ against Subject: hello                           
Not matched.                                                                   
Matching /^X-Spam-Flag: YES/ against Message-Id: <20070216030824.18A1F1CF3AB@localhost.localdomain>                                                           
Not matched.                                                                   
Matching /^X-Spam-Flag: YES/ against Date: Fri, 16 Feb 2007 14:08:24 +1100 (EST)
Not matched.                                                                   
Matching /^X-Spam-Flag: YES/ against From: matthew@localhost.localdomain (Matthew Percival)                                                                   
Not matched.                                                                   
/etc/maildroprc(11): Search of ^X-Spam-Flag: YES = 0                           
/etc/maildroprc(11): IF evaluated, result=0                                   
maildrop: Attempting .mailfilter                                               
maildrop: Delivering to /var/spool/mail/root                                   
maildrop: Flock()ing /var/spool/mail/root.                                     
maildrop: Appending to /var/spool/mail/root.                                   
maildrop: Delivery complete.

Sure enough, /var/spool/mail/root now has a new email and everything seems fine. For what it is worth, my /etc/maildroprc is as follows:
Code:

DEFAULT="/var/spool/mail/root"                                                 
SHELL="/bin/sh"                                                               
SENDMAIL="/usr/sbin/sendmail"                                                 
                                                                               
if ( /^X-Virus-Flag: YES/ )                                                   
{                                                                             
        `maildirmake -f Virus "$DEFAULT"`                                     
        to "/dev/null"                                                         
}                                                                             
                                                                               
if ( /^X-Spam-Flag: YES/ )                                                     
{                                                                             
        `maildirmake -f Spam "$DEFAULT"`                                       
        to "/dev/null"                                                         
}                                                                             
# eof

Clearly maildrop works fine, so I would imagine the issue lies in sendmail. Trying the following test:
Code:

cat test.email | sendmail -v matthew
I get this:
Code:

Who are you?: Permission denied                                               
matthew... Connecting to [127.0.0.1] via relay...                             
220 osk.capgo.com ESMTP Sendmail 8.13.6/8.13.6; Wed, 31 Dec 1969 23:49:03 -0600
>>> EHLO osk.capgo.com                                                         
250-osk.capgo.com Hello localhost.localdomain [127.0.0.1], pleased to meet you 
250-ENHANCEDSTATUSCODES                                                       
250-PIPELINING                                                                 
250-EXPN                                                                       
250-VERB                                                                       
250-8BITMIME                                                                   
250-SIZE                                                                       
250-DSN                                                                       
250-ETRN                                                                       
250-DELIVERBY                                                                 
250 HELP                                                                       
>>> VERB                                                                       
250 2.0.0 Verbose mode                                                         
>>> MAIL From:<postmaster@osk.capgo.com> SIZE=515                             
250 2.1.0 <postmaster@osk.capgo.com>... Sender ok                             
>>> RCPT To:<matthew@osk.capgo.com>                                           
>>> DATA                                                                       
050 /etc/mail/aliases: 26 aliases, longest 10 bytes, 287 bytes total           
550 5.1.1 User unknown                                                         
503 5.0.0 Need RCPT (recipient)                                               
>>> RSET                                                                       
250 2.0.0 Reset state                                                         
>>> RSET                                                                       
250 2.0.0 Reset state                                                         
postmaster... Using cached ESMTP connection to [127.0.0.1] via relay...       
>>> MAIL From:<> SIZE=1539                                                     
250 2.1.0 <>... Sender ok                                                     
>>> RCPT To:<postmaster@osk.capgo.com>                                         
>>> DATA                                                                       
050 <postmaster@osk.capgo.com>... aliased to root                             
050 root... aliased to root                                                   
250 2.1.5 <postmaster@osk.capgo.com>... Recipient ok                           
354 Enter mail, end with "." on a line by itself                               
>>> .                                                                         
050 root... Connecting to local...                                             
050 root... Deferred: local mailer (/usr/bin/maildrop) exited with EX_TEMPFAIL 
250 2.0.0 A015n3S6001690 Message accepted for delivery                         
postmaster... Sent (A015n3S6001690 Message accepted for delivery)             
Closing connection to [127.0.0.1]                                             
>>> QUIT                                                                       
221 2.0.0 osk.capgo.com closing connection

From what I can tell from Google, EX_TEMPFAIL means that maildrop should be the problem, yet it seems to work perfectly fine. I have been trying to find a solution to this for the past two days, but

EDIT (submitted by accident mid sentance):
...seem to be going around in circles. Any suggestions or guidance would be most welcome!

zaichik 02-17-2007 09:17 AM

It looks like maildrop is, indeed, the "problem", in that it is the one that is generating the error. But it looks like the real issue is that the user is unknown?

>>> RCPT To:<matthew@osk.capgo.com>
>>> DATA
050 /etc/mail/aliases: 26 aliases, longest 10 bytes, 287 bytes total
550 5.1.1 User unknown
503 5.0.0 Need RCPT (recipient)

Unless I am missing something, sendmail doesn't recognize matthew@osk.capgo.com as a valid user.

Elric of Grans 02-18-2007 04:25 PM

I tried the same experiment, only with root the recipiant:
Code:

Who are you?: Permission denied                                               
root... Connecting to [127.0.0.1] via relay...                                 
220 osk.capgo.com ESMTP Sendmail 8.13.6/8.13.6; Wed, 31 Dec 1969 18:03:40 -0600
>>> EHLO osk.capgo.com                                                         
250-osk.capgo.com Hello localhost.localdomain [127.0.0.1], pleased to meet you 
250-ENHANCEDSTATUSCODES                                                       
250-PIPELINING                                                                 
250-EXPN                                                                       
250-VERB                                                                       
250-8BITMIME                                                                   
250-SIZE                                                                       
250-DSN                                                                       
250-ETRN                                                                       
250-DELIVERBY                                                                 
250 HELP                                                                       
>>> VERB                                                                       
250 2.0.0 Verbose mode                                                         
>>> MAIL From:<postmaster@osk.capgo.com> SIZE=515                             
250 2.1.0 <postmaster@osk.capgo.com>... Sender ok                             
>>> RCPT To:<root@osk.capgo.com>                                               
>>> DATA                                                                       
050 /etc/mail/aliases: 27 aliases, longest 10 bytes, 298 bytes total           
050 aliased to guru                                                           
250 2.1.5 <root@osk.capgo.com>... Recipient ok                                 
354 Enter mail, end with "." on a line by itself                               
>>> .                                                                         
050 guru... Connecting to local...                                             
050 guru... Deferred: local mailer (/usr/bin/maildrop) exited with EX_TEMPFAIL 
250 2.0.0 A0103exm001616 Message accepted for delivery                         
root... Sent (A0103exm001616 Message accepted for delivery)                   
Closing connection to [127.0.0.1]                                             
>>> QUIT                                                                       
221 2.0.0 osk.capgo.com closing connection

The result looks slightly different, but maildrop is still dropping out. The messages are a little different, though it still does not deliver. Since maildrop clearly works, it would suggest some sort of a problem in the communications between sendmail and maildrop, though I would not know how that could be.


All times are GMT -5. The time now is 04:17 AM.