procmail
[Top] [All Lists]

Re: Multple actions per recipe (eg. bounce AND deliver locally).

2004-11-01 19:51:02
At 18:30 2004-11-01 -0600, Sean wrote:
I'm having a difficult time getting procmail to both deliver a message and
send a bounce back (autoresponder).

So far my only solution is to deliver everything local in .forward and
send to procmail.
eg:
        #cat .forward
        "|IFS=' '&& exec /usr/bin/procmail -f-||exit 75 #autoreply"
        \autoreply

This is not optimal.

I don't know if you normally have to use the .forward or not (if procmail isn't set up as the LDA on your host, then you're stuck with invoking it that way), but you should revert back to whatever you needed to just invoke procmail.

I've setup a new .procmailrc with the following:
#cat .procmailrc
LOGFILE="$HOME/procmail.log"
LOGABSTRACT=all
VERBOSE=on
:0

The 'c'opy flag is notably absent (and only needs to be on the first recipe here - if you put it on the second one, then you'd have an EXTRA copy in your system mailbox as well). Thus, the recipe operates on the ONE copy of the message, and when it's been piped to formail, it is considered to be delivered.

Additionally, there can be only ONE delivery line on a recipe, so lose the Maildir delivery which immediatley follows the formail invocation.

That makes the procmailrc something like the following (with some optimization - the header checks are "cheaper" than invoking an external program, so if they exclude a message from processing, you save cycles):

LOGFILE=$HOME/procmail.log
LOGABSTRACT=all
VERBOSE=on

:0c
* !^FROM_DAEMON
* !^FROM_MAILER
* $ !^From:(_dot_)*$LOGNAME(_at_)domain\(_dot_)com
* $ !^X-Loop: $LOGNAME(_at_)$HOST
* $ ?/usr/bin/test -e $HOME/autoreply.txt
| ( formail -r -A"X-Loop: $LOGNAME(_at_)$HOST"; \
        cat "$HOME/autoreply.txt" ) | $SENDMAIL -t -oi

:0
Maildir/

---
 Sean B. Straw / Professional Software Engineering

 Procmail disclaimer: <http://www.professional.org/procmail/disclaimer.html>
 Please DO NOT carbon me on list replies.  I'll get my copy from the list.


____________________________________________________________
procmail mailing list   Procmail homepage: http://www.procmail.org/
procmail(_at_)lists(_dot_)RWTH-Aachen(_dot_)DE
http://MailMan.RWTH-Aachen.DE/mailman/listinfo/procmail

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