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
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):
# extract real destination - this part works
WHOFOR|/bin/egrep '^Delivered-To:' | sed -e
# if locally deliverable
* |/usr/sbin/sendmail -bv $ANDY >/dev/null
# then deliver it
# else deliver it to root
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
an infinite recursion - is procmail not called in its delivery ?
How does this work from a .procmailrc called as normal from
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/