I'm fetching multi-recipient mail from one
mailbox with pop3 and feeding to sendmail and hence
procmail. On each mail in there is a Delivered-To
field with a codified version of the original
intended recipient (all receipients in the
same domain).
I want a recipe that extracts that coded
address from a Delivered-To field
(I can do this), checks whether that address is locally deliverable
and if it is delivers it and otherwise delivers the mail to
some specificed local account (such as root) instead of bouncing it.
What's wrong with this (which doesn't work - I commented it
for explanation here):
:0c
# extract real destination - this part works
WHOFOR|/bin/egrep '^Delivered-To:' | sed -e
's/^.*zz_plusz-axelrod-//;s/@.*//'
:0
# if locally deliverable
* |/usr/sbin/sendmail -bv $ANDY >/dev/null
# then deliver it
! $WHOFOR(_at_)localhost
:0
# else deliver it to root
! root(_at_)localhost
#fi
Some questions:
1. How can I have a condition that runs a program and
is true if the return code is 0 and false otherwise
(as in the attempt with sendmail -bv here).
2. If this runs as root are there any looping problems ?
Presumably on delivery this script will be called again.
What if it doesn't run as root or non-locally-delivered gets
sent to some other account and then mail arrives for that account ?
3. If I dump the attempt to filter and deliver the non-locally
deliverable then delivery seems to work. BUT - since delivery
calls this script recursively (I think) why doesn't it loop
endlessly ? Does the delivery line somehow avoid procmail
being called ? In other words why isn't this
:0
! someone(_at_)localhost
an infinite recursion - is procmail not called in its delivery ?
How does this work from a .procmailrc called as normal from
sendmail.
____________________________________________________________________
eKit - the global phonecard with more!
Spend less on overseas calls, receive messages worldwide.
Visit http://www.ekit.com/ for details.
____________________________________________________________
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