You are viewing a plain text version of this content. The canonical link for it is here.
Posted to server-user@james.apache.org by Phil Spencer <ph...@gna.sh> on 2012/02/08 21:23:38 UTC
Mail Routing Basics
Hi All,
I'm new to James and having trouble with what is probably a really basic concept
Here's my problem - I want to listen for incoming SMTP traffic and on the basis of the X-Headers of each message I want to do some processing and then, again based on the X-Headers, deliver to a specific remote server
The essence of what I'm trying to achieve is shown by the config snippet below
The problem is of course is that the remote RemoteDelivery mailets, once triggered by an incoming message, do the correct thing for that message then listen for **any** further messages regardless of whether they match the matcher criteria or not!
So the question is what basic structure to I need to achieve my goal? The detail seems to wok fine: custom mailets, custom matchers, etc. It's the bigger picture I'm missing. I tried looking at the source and on the Internet but found nothing that looks relevant
Phil
<matcher name="Case1" match="And">
<matcher match="HasHeader=X-..."/>
..
</matcher>
<matcher name="Case2" match="And">
<matcher match="HasHeader=X-..."/>
..
</matcher>
...
<matcher name="CaseN" match="And">
<matcher match="HasHeader=X-..."/>
..
</matcher>
<mailet match="Case1" class="Case1Mailet">
...
</mailet>
<mailet match="Case1" class="RemoteDelivery">
<outgoingQueue>outgoing</outgoingQueue>
<delayTime>...</delayTime>
<maxRetries>25</maxRetries>
<maxDnsProblemRetries>0</maxDnsProblemRetries>
<deliveryThreads>10</deliveryThreads>
<sendpartial>true</sendpartial>
<bounceProcessor>bounces</bounceProcessor>
<gateway>Case1Server:port</gateway>
<debug>true</debug>
</mailet>
...
<mailet match="CaseN" class="CaseNMailet">
...
</mailet>
<mailet match="CaseN" class="RemoteDelivery">
<outgoingQueue>outgoing</outgoingQueue>
<delayTime>...</delayTime>
<maxDnsProblemRetries>0</maxDnsProblemRetries>
<deliveryThreads>10</deliveryThreads>
<sendpartial>true</sendpartial>
<bounceProcessor>bounces</bounceProcessor>
<gateway>CaseNServer:port</gateway>
<debug>true</debug>
</mailet>
Re: Mail Routing Basics
Posted by Eric Charles <er...@apache.org>.
Hi,
Don't know if the configuration you are trying behaves as expected or
there is a bug in the james code (the *any* message being remote
delivered)... ?
To better separate logic, you could use processors:
<processor state="root">
<mailet match="HasHeader=X-1" class="ToProcessor">
<processor>header-x-1</processor>
</mailet>
<mailet match="HasHeader=X-2" class="ToProcessor">
<processor>header-x-2</processor>
</mailet>
...
</processor>
<processor state="header-x-1">
... do stuff...
<mailet match="All" class="RemoteDelivery">
...
<gateway>gateway1</gateway>
</mailet>
</processor>
<processor state="header-x-2">
... do stuff...
<mailet match="All" class="RemoteDelivery">
...
<gateway>gateway1</gateway>
</mailet>
</processor>
Thx,
Eric
On 08/02/12 21:23, Phil Spencer wrote:
> Hi All,
>
> I'm new to James and having trouble with what is probably a really basic concept
>
> Here's my problem - I want to listen for incoming SMTP traffic and on the basis of the X-Headers of each message I want to do some processing and then, again based on the X-Headers, deliver to a specific remote server
>
> The essence of what I'm trying to achieve is shown by the config snippet below
>
> The problem is of course is that the remote RemoteDelivery mailets, once triggered by an incoming message, do the correct thing for that message then listen for **any** further messages regardless of whether they match the matcher criteria or not!
>
> So the question is what basic structure to I need to achieve my goal? The detail seems to wok fine: custom mailets, custom matchers, etc. It's the bigger picture I'm missing. I tried looking at the source and on the Internet but found nothing that looks relevant
>
> Phil
>
> <matcher name="Case1" match="And">
> <matcher match="HasHeader=X-..."/>
> ..
> </matcher>
>
> <matcher name="Case2" match="And">
> <matcher match="HasHeader=X-..."/>
> ..
> </matcher>
> ...
> <matcher name="CaseN" match="And">
> <matcher match="HasHeader=X-..."/>
> ..
> </matcher>
>
>
> <mailet match="Case1" class="Case1Mailet">
> ...
> </mailet>
> <mailet match="Case1" class="RemoteDelivery">
> <outgoingQueue>outgoing</outgoingQueue>
> <delayTime>...</delayTime>
> <maxRetries>25</maxRetries>
> <maxDnsProblemRetries>0</maxDnsProblemRetries>
> <deliveryThreads>10</deliveryThreads>
> <sendpartial>true</sendpartial>
> <bounceProcessor>bounces</bounceProcessor>
>
> <gateway>Case1Server:port</gateway>
> <debug>true</debug>
> </mailet>
> ...
> <mailet match="CaseN" class="CaseNMailet">
> ...
> </mailet>
> <mailet match="CaseN" class="RemoteDelivery">
> <outgoingQueue>outgoing</outgoingQueue>
> <delayTime>...</delayTime>
> <maxDnsProblemRetries>0</maxDnsProblemRetries>
> <deliveryThreads>10</deliveryThreads>
> <sendpartial>true</sendpartial>
> <bounceProcessor>bounces</bounceProcessor>
>
> <gateway>CaseNServer:port</gateway>
> <debug>true</debug>
> </mailet>
>
>
--
eric | http://about.echarles.net | @echarles
---------------------------------------------------------------------
To unsubscribe, e-mail: server-user-unsubscribe@james.apache.org
For additional commands, e-mail: server-user-help@james.apache.org