Ciao Marcello,
Yes, it is very easy to create IF / AND / OR / ELSE type of logic with
MAILETS, MATCHERS and PROCESSORS in your config.xml. Here you have an
example regarding chaining mailets:
--- START ---
--- 'OR' CONDITION ---
<processor name="root">
<!-- If condition 'SenderIs' is met, send to isGoodMail -->
<mailet match="[EMAIL PROTECTED]"
class="ToProcessor">
<processor> isGoodMail </processor>
</mailet>
<!-- If condition 'SenderIs' is not met BUT condition 'SubjectIs'
is met, send still to isGoodMail -->
<mailet match="SubjectIs=something"
class="ToProcessor">
<processor> isGoodMail </processor>
</mailet>
<!-- else, do something (for instance, mark as spam) -->
<mailet match="All"
class="ToProcessor">
<processor> spam </processor>
</mailet>
</processor>
<processor name="isGoodMail">
<mailet match="All"
class="YourMailet">
<condition> yourCondition </condition>
</mailet>
<!-- Remember to send to 'transport' processor afterwards if you
want the mail to be delivered -->
</processor>
--- 'AND' CONDITION ---
<processor name="root">
<!-- If condition 'SenderIs' is met, send to processor
'isGoodSender' below -->
<mailet match="[EMAIL PROTECTED]"
class="ToProcessor">
<processor> isGoodSender </processor>
</mailet>
<!-- else, do something (for instance, mark as spam) -->
<mailet match="All"
class="ToProcessor">
<processor> spam </processor>
</mailet>
</processor>
<processor name="isGoodSender">
<!-- If condition 'SenderIs' is met AND condition
'SubjectIs' is met, use YourMailet to do your specific processing. -->
<mailet match="SubjectIs=something"
class="YourMailet">
<condition> yourCondition </condition>
</mailet>
<!-- Remember to send to 'transport' processor afterwards if you
want the mail to be delivered -->
<!-- else, do something (for instance, mark as spam) -->
<mailet match="All"
class="ToProcessor">
<processor> spam </processor>
</mailet>
</processor>
--- END ---
In your case, you can use HasHeader matcher as it is for routing some mail
to a different processor, and the following mailet / matcher pair in THE
CURRENT processor would effectively be your ELSE action.
Hope it helps,
Br,
Isaac.
-----Original Message-----
From: Marcello Marangio [mailto:[EMAIL PROTECTED]
Sent: jueves, 10 de junio de 2004 16:12
To: James Users List
Subject: two ways matcher...
Hi All.
I have to modify the HasHeader matcher into a HasNotHeader matcher.
I was wondering....
Is it possible to set up the config.xml file so that
"if matcherX matches then do mailetA else do mailetB" ?
Or, given a mailet, wouldn't be possible to configure a thing like "if
matcherY doesn't match do mailet A" ?
Did anyone have the same issue?
Thanks
Marcello
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]