When using procmail with maildir, it returns error with code I found

Posted by bradlis7 on Server Fault See other posts from Server Fault or by bradlis7
Published on 2010-03-18T13:55:26Z Indexed on 2010/03/18 14:01 UTC
Read the original article Hit count: 522

Filed under:
|
|

I'm not an expert at procmail, but I have this code:

DROPPRIVS=yes

DEFAULT=$HOME/Maildir/

:0
* ? /usr/bin/test -d $DEFAULT || /bin/mkdir $DEFAULT
{ }
:0 E
{
        # Bail out if directory could not be created
        EXITCODE=127
        HOST=bail.out
}

MAILDIR=$HOME/Maildir/

But, when the directory already exists, sometimes it will send a return email with this error: 554 5.3.0 unknown mailer error 127. The email still gets delivered, mind you, but it sends back an error code.

I fixed this temporarily by commenting out the EXITCODE and HOST lines, but I'd like to know if there is a better solution.

I found this block of code in multiple places across the net, but couldn't really find why this error was coming back to me. It seems to happen when I send an email to a local user, sometimes the user has a .forward file to send it on to other users, sometimes not, but the result has been the same. I also tried removing DROPPRIVS, just in case it was messing up the forwarding, but it did not seem to affect it.

Is the line starting with * ? /usr/bin/test a problem? The * signifies a regex, but the ? makes it return an integer value, correct? What is the integer being matched against? Or is it just comparing the integer return value?

Thanks for the help.

© Server Fault or respective owner

Related posts about procmail

Related posts about email