At 14:15 2002-04-26 -0400, Terry Mac Millan did say:
I would like to set up a rule that would take and forward the email off to
another address if a certian header is not listed, but if it is, deliver
it to the local email box.
First off, you should have procmail installed and have gone through some
basic checks to see that it is. See the docs for that.
'man procmailex' shows examples - it should be VERY useful for learning the
constructs.
At the most basic level, the following would achieve something like you're
asking:
:0
* ! ^someheader:
! otheraddress(_at_)domain(_dot_)tld
Within a condition (the lines starting with a *), ! is logical NOT. It has
a different meaning when used at the beginning of the delivery line, where
it is the forward construct.
When forwarding to another address (esp if it might bounce back to you -
and assume that EVERY forward can), you should add an X-Loop header and
check for that before attempting to forward, and probably also check that
the message isn't from a mailer (which you could deal with by handling
mailer messages and X-Loop BEFORE this recipe):
:0
* ! ^someheader:
* ! ^X-Loop: myaddress
* ! ^FROM_MAILER
| formail -I "X-Loop: myaddress" | $SENDMAIL otheraddress(_at_)domain(_dot_)tld
You might even want to add the following condition:
* ! ^From:(_dot_)*otheraddress(_at_)domain(_dot_)tld
Since you probably don't want to forward mail that the other address sends
this one...
Check the "sandbox" info in my disclaimer - you can test this sort of
recipe in a controlled environment BEFORE placing it into your active mail
stream (where a minour glitch could cause you a LOT of grief in a hurry - a
1KB forwarded message which bounces and loops can snowball into a
multi-megabyte message quickly - now have ten such messages bouncing around
concurrently, and things get super nasty).
---
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(_at_)lists(_dot_)RWTH-Aachen(_dot_)DE
http://MailMan.RWTH-Aachen.DE/mailman/listinfo/procmail