procmail
[Top] [All Lists]

Re: Using Procmail to selectively filter off outgoing SMTP with Postfix

2001-03-14 08:59:58

What I have set up in prototype is an master account which receives all 
output from the Postfix "always_bcc" config option. This account has a 
.procmailrc + the standard procmail forward set up.

.forward = "|IFS=' ' && exec /usr/local/bin/procmail -f- || exit 75#mailtest"

With very simple test recipe as below, it performs as expected, a message 
from the target generates exactly one forwarded message to the coasupport 
address (it only sends one copy even if the original message had more than 
one recipient, which is what we want).


DEFAULT=/dev/null
:0
* ^X-Sender: manager(_at_)mail(_dot_)coa(_dot_)cranfield(_dot_)ac(_dot_)uk
! coasupport(_at_)cranfield(_dot_)ac(_dot_)uk

However, it does, however, also try to send a copy to the master account 
itself which generates a mail forwarding loop, this is detected by Postfix 
which handles it. The message to MAILER_DAEMON gets dumped to /dev/null 
(which is acceptable I guess) but in the process, it writes syslog records 
which are going to bump up the size of my log files.

Has anyone seen this before or got a work around for it ?
 
 I can see what's happening, but I think your analysis is not correct
 in all details.

 What (presumably) happens is that mail to the forwarded address in turn
 is subject to postfix' "always_bcc". You should be able to get around this
 by using formail to add another header as per man procmailex(5) (search for
 "Suppose you have two accounts,"):

DEFAULT=/dev/null
:0
* ^X-Sender: manager(_at_)mail(_dot_)coa(_dot_)cranfield(_dot_)ac(_dot_)uk
* !^X-Loop: masteraccount(_at_)mail(_dot_)coa(_dot_)cranfield(_dot_)ac(_dot_)uk
| formail -A "X-Loop: 
masteraccount(_at_)mail(_dot_)coa(_dot_)cranfield(_dot_)ac(_dot_)uk" | \
   $SENDMAIL -oi coasupport(_at_)cranfield(_dot_)ac(_dot_)uk

 This is completely untested, of course :)

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