Re: Advice sought for mailets

Benoit TELLIER <[email protected]> Mon, 8 Jan 2024 14:05:18 +0100
Newsgroups gmane.comp.jakarta.james.user
Message-ID <[email protected]>
Hello Matt,

1. is easy: just put it at the beginning of the transport protocol.

2. is slightly more challenging:
  a. For RemoteDelivery use onSuccess property to pass a callback upon 
success (need another processor)
  b. For LocalDelivery pass property consume to false and handle success 
afterward il a processor called "local-delivery" is a common practice.

3. is slightly harder. You would need to plug your logic in the various 
places handling all kind of error: error processor, rrt-error processor, 
bounces processor, local-address-error, relay-denied ...

Hope this helps.

Best regards,

Benoit

On 08/01/2024 13:51, Matt Pryor wrote:
> Hi there
>
> I am hoping to implement three custom mailets for our James 3.8.0
> installation:
>
> 1) to be called when an email is submitted via SMTP
> 2) to be called when an email is successfully delivered
> OR
> 3) to be called when an email permanently fails to deliver
>
> I was hoping to be able to tie the submission and success / failures
> together based on message ID.
>
> Is this possible and if so, can someone advise where best to place the
> mailet tags? I've tried this (in mailetcontainer.xml) but it doesn't seem
> to be getting called although I can see it gets initiated on startup:
>
>          <processor state="bounces" enableJmx="true">
>              <mailet match="All" class="MetricsMailet">
>                  <metricName>bounces</metricName>
>              </mailet>
>              <mailet match="All" class="DSNBounce">
>                  <passThrough>false</passThrough>
>              </mailet>
> <mailet match="All"
> class="com.internationalpresence.mailet.RecordBounceMailet">
>      <folder>./bounces/</folder>
> </mailet>
>          </processor>
>
> Thanks and kind regards
> Matt
>
>
>