procmail
[Top] [All Lists]

Re: Strange procmail behavior

2002-07-17 10:35:02
"Matthias Wulkow" <trespassa(_at_)gmx(_dot_)de> writes:
All of a sudden, since this morning, procmail decided that root doesn't get an
y mail anymore and redirects all incoming
mail to root to nobody.
Why?

I would _guess_ that your MTA is at fault.  What do its logs show when
you try to send a message to root?


...
I have set up an alias ftp-admin: root in /etc/aliases and used newaliases
to update the db.
...
:0 c:
* ^TOftp-admin
* ^Subject:.*ftp-liste
| /usr/sbin/ftp-mail-text.cfg > /etc/ftp-mail-text.txt

:0 h w
* ^TOftp-admin
* ^Subject:.*ftp-liste
| ( formail -r -A "X-Loop: ftp-admin(_at_)mydomain(_dot_)net"
      -I "From: ftp-admin(_at_)mydomain(_dot_)net" ; cat 
/etc/ftp-mail-text.txt ) |
$SENDMAIL -oi -t


Since ftp-admin is forwarded to root, I suggest putting these in root's
.procmailrc file.  (Avoid putting something in the /etc/procmailrc file
that only applies to one user.)

Next, there's no need to test the conditions twice when they're the same;
just use a nested block instead.  Finally, since you need to lock the
/etc/ftp-mail-text.txt file all the way across the two actions, you need
to use a global lockfile instead of a locallockfile.

So:

        :0
        * ^TO_ftp-admin
        * ^Subject:.*ftp-liste
        * ! ^X-Loop: ftp-admin(_at_)mydomain\(_dot_)net
        {
                # what's the file to use?  Then lock it
                tfile = /etc/ftp-mail-text.txt
                LOCKFILE = $tfile.$LOCKEXT

                # do whatever to create the file contents
                :0 c
                | /usr/sbin/ftp-mail-text.cfg > $tfile

                # now do something with them
                :0 hw
                | ( formail -r -A "X-Loop: ftp-admin(_at_)mydomain(_dot_)net" \
                        -I "From: ftp-admin(_at_)mydomain(_dot_)net" ; \
                    cat $tfile ) | $SENDMAIL $SENDMAILFLAGS -t

                # unlock it if it fails (on success it exits)
                LOCKFILE
        }


Philip Guenther
_______________________________________________
procmail mailing list
procmail(_at_)lists(_dot_)RWTH-Aachen(_dot_)DE
http://MailMan.RWTH-Aachen.DE/mailman/listinfo/procmail

<Prev in Thread] Current Thread [Next in Thread>