On Fri, Mar 07, 2008 at 05:30:42PM +0000, Paul Gardiner wrote:
For mail that comes into my secondary MX, I use the following to
sort mail to valid addresses from that to invalid ones:
:0
* ^To.*glidos\.net
{
VALID=`cat /etc/postfix/virtual | sed -n -e
's/^\((_dot_)*(_at_)glidos(_dot_)net\).*$/\1/p' | sed -e 's/ /|/g'`
:0:
* ? formail -x To: -c | egrep -i ${VALID}
.Glidos.Glidos/
:0:
.Stuff.Invalid/
}
Used to work fine, but as the number of addresses stored in "virtual"
has increased, it fails to match some of the later ones. It's as
thought there's a line length limit. I tried splitting the content
of "VALID" into two and checking each part separately. That didn't
help, so maybe its nothing to do with line length limits.
I don't know, but your sed statements aren't very efficient. You
shouldn't need to pipe sed through sed.
Try something like this there:
VIRTUAL = /etc/postfix/virtual
VALID = `fmt -1 "$VIRTUAL" | sed -n '/@glidos[.]net/{s/[^a-zA-Z]*$//;
s/$/|\\/p;}'`
VALID = "(${VALID}dummy)"
Another problem is that you will get false positives on addresses
that are subsets of others. Example: valid address
goldman(_at_)glidos(_dot_)net;
spam comes in to dman(_at_)glidos(_dot_)net(_dot_) Use the -w option to egrep.
Dallman
____________________________________________________________
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