procmail
[Top] [All Lists]

Re: Forwarding with procmail

2001-11-16 10:48:09
At 16:36 2001-11-16 +0100, Giuliano Cocchi wrote:

This is my problem.
I use Postfix as MTA and procmail as MDA.
I want that procmail filter all mail comed in in this way:

all mail coming from domai1 or domain2 must go to right destination but a
copy of this mail must go in my box.
[snip]

No. The syntax of your match line is wrong (at a minimum, it is missing the * at the beginning of the line which identifies it as a condition rather than a delivery, but the syntax of the regexp is unlikely to match DOMAIN constructs if you don't include a lead-in wildcard), and if you're sending a COPY of the message, you need to specify the 'c'opy flag.

Even if you fixed these problems, you have the potential for a mail loop here - if "my account" is local, the delivery should re-invoke the /etc/procmailrc - which means it'll trip this rule again.


# add 'c' for COPY flag.  Otherwise, you're changing simply directing
# the mail to your account, but not sending it along to the original
# destination
:0c
* ! ^X-Loop: myaccount(_at_)whereever
* ! ^TO_myaccount
* ^From:.*@(domain1|domain2)
| formail -A "X-Loop: myaccount(_at_)whereever" | $SENDMAIL myaccount

This would add a custom loop header, and tell sendmail to deliver it to your other account. It shouldn't invoke if the loop header exists or if you're already _supposed_ to be a recpient.

$SENDMAIL should probably be defined as the postfix path, and if postfix is any good as a sendmail drop-in replacement, it should accept the same params.

MAILER_DAEMON is another condition to consider excluding from the forward, at least if your 'myaccount' is at the domains that you're processing this on -- if the forward to myaccount bounces, it'll loop.

---
 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

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