Re: Advice sought for mailets

Benoit TELLIER <[email protected]> Thu, 11 Jan 2024 16:20:50 +0100
Newsgroups gmane.comp.jakarta.james.user
Message-ID <[email protected]>
Set passthrough to ture for DSNBounce mailet in bounces processor.

On 11/01/2024 15:15, Matt Pryor wrote:
> Hi Benoit, thanks for the reply.
>
> My mailetconfig.xml now looks like this:
>
> <processor state="local-address-error" enableJmx="true">
>              <mailet match="All" class="MetricsMailet">
>                  <metricName>mailetContainerLocalAddressError</metricName>
>              </mailet>
>              <mailet match="All" class="Bounce">
>                  <attachment>none</attachment>
>              </mailet>
>              <mailet match="All" class="ToRepository">
>
> <repositoryPath>file://var/mail/address-error/</repositoryPath>
>              </mailet>
>
>
> * <mailet match="All"
> class="com.internationalpresence.mailet.RecordBounceMailet">
> <folder>./bounces/</folder> </mailet>*
>          </processor>
>
>          <processor state="relay-denied" enableJmx="true">
>              <mailet match="All" class="MetricsMailet">
>                  <metricName>mailetContainerRelayDenied</metricName>
>              </mailet>
>              <mailet match="All" class="Bounce">
>                  <attachment>none</attachment>
>              </mailet>
>              <mailet match="All" class="ToRepository">
>
> <repositoryPath>file://var/mail/relay-denied/</repositoryPath>
>                  <notice>Warning: You are sending an e-mail to a remote
> server. You must be authenticated to perform such an operation</notice>
>              </mailet>
>
>
> * <mailet match="All"
> class="com.internationalpresence.mailet.RecordBounceMailet">
> <folder>./bounces/</folder> </mailet>*
>          </processor>
>
>          <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>
>
>          <processor state="rrt-error" enableJmx="false">
>              <mailet match="All" class="ToRepository">
>                  <repositoryPath>file://var/mail/rrt-error/</repositoryPath>
>                  <passThrough>true</passThrough>
>              </mailet>
>              <mailet match="IsSenderInRRTLoop" class="Null"/>
>              <mailet match="All" class="Bounce"/>
>
>
> * <mailet match="All"
> class="com.internationalpresence.mailet.RecordBounceMailet">
> <folder>./bounces/</folder> </mailet>*
>          </processor>
>
> however my mailet (RecordBounceMailet) still doesn't appear to be being
> called anywhere when I trigger a bounced email.
>
> Please can you point me to where I've gone wrong?
>
> Thanks
> Matt
>
>
> On Mon, 8 Jan 2024 at 13:05, Benoit TELLIER <[email protected]> wrote:
>
>> 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
>>>
>>>
>>>
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: [email protected]
>> For additional commands, e-mail: [email protected]
>>
>>