procmail
[Top] [All Lists]

GREPing files in procmail conditions

2003-12-06 21:21:20
Hi!
First off: I am a newbie, all I know is the manpages and the Bronto-FAQ.

I ran into a problem that I don't know how to solve.

Configuration:
Postfix gets the Mail for the domain via UUCP, then passes it to procmail.
Procmail passes it through spamassassin.

Situation:
Many SPAM-Messages have forged From:-Headers and also randomly generated To:-Headers. As my system sends out bounce messages (and is supposed to do so), this means: A SPAM-Message gets bounced and provokes a re-Bounce due to the forged header.

Intent:
I want to make a procmail rule that forwards undeliverable messages with X-SPAM-Flag: Yes-Header to nobody (/dev/null).

What I have:
A rule to forward all SPAM-Messages to nobody would be:
:0
*^X-SPAM-Flag:.*YES
!nobody

That causes the problem of false positives being dropped, which I do not want.

With (cut -d: -f 1 /etc/passwd /etc/aliases | grep -v '^#'), I get a list of all legal recipients on my system.

What I want:
Pseudo-Code:
:0
*^To: {!(grep %mail-recipient% (cut -d: -f 1 /etc/passwd /etc/aliases | grep -v '^#'))}
*^X-SPAM-Flag:.*YES
!nobody

Snoopy sleeps in the second line :-(
I don't know where I can take what I called "%mail-recipient%" and how I can invoke grep and cut from out of a condition.

Questions:
a) Can anybody help, either with a solution or with a documentation / tutorial I did not find until now? b) What I plan to do - is this a valid way, or too complicated / inefficient?

Thanks for all who help!

Yours
  Ralf

--
Diese Nachricht wurde per EDV erstellt und wäre somit auch mit Unterschrift ungültig.


_______________________________________________
procmail mailing list
procmail(_at_)lists(_dot_)RWTH-Aachen(_dot_)DE
http://MailMan.RWTH-Aachen.DE/mailman/listinfo/procmail