* Matthias Andree <ma...@dt.e-technik.uni-dortmund.de> wrote:
Marcus Frings <iam-...@fuckmicrosoft.com> writes:
/*** begin mailfilter file ***/
import EXT
import HOST
import HOME
MAX = 15
These import EXT, HOST and HOME from the environment (I wonder why he
imports HOME though -- perhaps because maildrop resets it to the
default).
Yes, the variables were already clear to me.
if ((/^X-Spam-Status: Yes, hits=![0-9]+\.[0-9]+!.*/:h && $MATCH2 >
$MAX))
{
exit
}
I guess I will never completely understand the full syntax of regular
expressions and maildrop's filter language so I hope you could help me
to understand the recipe above. As far as I understand it tests the
"X-Spam-Status"-line if the required hits are greater than 15 and then
just exits. But why would anyone do so? And why is "((...))" used and
not only "(...)"?
I don't think (( )) makes a difference. The exclamation points you see
split up the regular expression -- see man maildropfilter, section
"PATTERN MATCH RESULTS". Effectively, this checks if a header matching
^X-Spam-Status: Yes, hits=[0-9]+\.[0-9]+ exists, and if it does, it
extracts the number after hits into $MATCH2, and then the expression
checks if the number so extracted is greater than $MAX (15) -- if it
does, the mail is dropped (exit).
Thanks for the detailed explanation of the regular expression,
Matthias. After reading the manpage I think I have understood now what
the exit directive does (at first I did not really understood why he
uses `exit' because I wondered how the mail is going to be processed
further).
,----[ man maildropfilter ]
| The exit statement causes maildrop to terminate without delivering the
| message anywhere.
`----
So `exit' is just an equivalent for moving a mail to /dev/null, right?
Regards,
Marcus