You are viewing a plain text version of this content. The canonical link for it is here.
Posted to server-dev@james.apache.org by Jerry Malcolm <te...@malcolms.com> on 2019/10/07 01:43:54 UTC

"Remote Delivery Success" Logger Hook?

One more request for advice while I'm thinking about it.... I have a 
client that has a requirement for a db entry for each mail item going in 
or out for a certain domain that logs the final result.  For outbound, 
the db entry will either be a bounce message or the 'success' log entry 
that says something like:

Mail xyz sent successfully to target-smtp.aaaaaaa.com. at xx.xxx.xxx.xxx 
from me@mydomain.com for [you@yourdomain.com]

Inbound email just needs to log the email to/from/subj and the target 
folder it was stored in.

Inbound and bounces are not an issue.  I can just add mailets to the 
bounce processor and to the transport processor for inbound. No concerns 
there.

The real issue is hooking the final success where the mail was 
successfully transferred out to the target smtp server (possibly after 
retries, etc).  Back in v3b5 I had a total hack adding my custom code to 
the RemoteDelivery mailet. It's worked fine for years.  But I don't want 
to repeat that moving forward to 3.3+. And the remoteDelivery logic has 
changed in 3.3.  So it doesn't appear my hack would still work anyway.   
But I still need the function.  I would like to add a hook or listener 
externally without having to build it into a custom James build if 
possible. I've been looking into HookResultLogger and 
CoreCmdHandlerLogger. But I don't see a way to register an additional 
logger short of changing the core code.

So... my question is: what is the best way to add a logger at the point 
where the outbound transfer has just completed?  If it requires 
modification to the core James code, I have no problem creating a custom 
build.  I just need advice as to where to do the surgery and what the 
recommended solution is in the opinion of the experienced James team.

Thanks,

Jerry


---------------------------------------------------------------------
To unsubscribe, e-mail: server-dev-unsubscribe@james.apache.org
For additional commands, e-mail: server-dev-help@james.apache.org


Re: "Remote Delivery Success" Logger Hook?

Posted by Jerry Malcolm <te...@malcolms.com>.
I love this idea.  Thanks.  This is going to be very helpful for those 
of us with paranoid clients that can't sleep until they know for certain 
that an email got there. :-)

I can assist in testing whenever this goes into the build.  No rush.  
I've created a workaround for now.

Jerry

On 10/7/2019 12:19 AM, Tellier Benoit wrote:
> Hi Jerry,
>
> Regarding that one I believe the best move is relying on the mailet
> extension system by defining a 'onSuccessProcessor' configuration option
> in the RemoteDelivery mailet.
>
> This requires adapting 'RemoteDelivery' code for allowing such an
> extension mechanism.
>
> I dropped what I had in mind, as well as related concerns in
> https://issues.apache.org/jira/browse/JAMES-2912
>
> Cheers,
>
> Benoit
>
> On 07/10/2019 08:43, Jerry Malcolm wrote:
>> One more request for advice while I'm thinking about it.... I have a
>> client that has a requirement for a db entry for each mail item going in
>> or out for a certain domain that logs the final result.  For outbound,
>> the db entry will either be a bounce message or the 'success' log entry
>> that says something like:
>>
>> Mail xyz sent successfully to target-smtp.aaaaaaa.com. at xx.xxx.xxx.xxx
>> from me@mydomain.com for [you@yourdomain.com]
>>
>> Inbound email just needs to log the email to/from/subj and the target
>> folder it was stored in.
>>
>> Inbound and bounces are not an issue.  I can just add mailets to the
>> bounce processor and to the transport processor for inbound. No concerns
>> there.
>>
>> The real issue is hooking the final success where the mail was
>> successfully transferred out to the target smtp server (possibly after
>> retries, etc).  Back in v3b5 I had a total hack adding my custom code to
>> the RemoteDelivery mailet. It's worked fine for years.  But I don't want
>> to repeat that moving forward to 3.3+. And the remoteDelivery logic has
>> changed in 3.3.  So it doesn't appear my hack would still work anyway.
>> But I still need the function.  I would like to add a hook or listener
>> externally without having to build it into a custom James build if
>> possible. I've been looking into HookResultLogger and
>> CoreCmdHandlerLogger. But I don't see a way to register an additional
>> logger short of changing the core code.
>>
>> So... my question is: what is the best way to add a logger at the point
>> where the outbound transfer has just completed?  If it requires
>> modification to the core James code, I have no problem creating a custom
>> build.  I just need advice as to where to do the surgery and what the
>> recommended solution is in the opinion of the experienced James team.
>>
>> Thanks,
>>
>> Jerry
>>
>>
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: server-dev-unsubscribe@james.apache.org
>> For additional commands, e-mail: server-dev-help@james.apache.org
>>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: server-dev-unsubscribe@james.apache.org
> For additional commands, e-mail: server-dev-help@james.apache.org
>

---------------------------------------------------------------------
To unsubscribe, e-mail: server-dev-unsubscribe@james.apache.org
For additional commands, e-mail: server-dev-help@james.apache.org


Re: "Remote Delivery Success" Logger Hook?

Posted by Tellier Benoit <bt...@apache.org>.
Hi Jerry,

Regarding that one I believe the best move is relying on the mailet
extension system by defining a 'onSuccessProcessor' configuration option
in the RemoteDelivery mailet.

This requires adapting 'RemoteDelivery' code for allowing such an
extension mechanism.

I dropped what I had in mind, as well as related concerns in
https://issues.apache.org/jira/browse/JAMES-2912

Cheers,

Benoit

On 07/10/2019 08:43, Jerry Malcolm wrote:
> One more request for advice while I'm thinking about it.... I have a
> client that has a requirement for a db entry for each mail item going in
> or out for a certain domain that logs the final result.  For outbound,
> the db entry will either be a bounce message or the 'success' log entry
> that says something like:
> 
> Mail xyz sent successfully to target-smtp.aaaaaaa.com. at xx.xxx.xxx.xxx
> from me@mydomain.com for [you@yourdomain.com]
> 
> Inbound email just needs to log the email to/from/subj and the target
> folder it was stored in.
> 
> Inbound and bounces are not an issue.  I can just add mailets to the
> bounce processor and to the transport processor for inbound. No concerns
> there.
> 
> The real issue is hooking the final success where the mail was
> successfully transferred out to the target smtp server (possibly after
> retries, etc).  Back in v3b5 I had a total hack adding my custom code to
> the RemoteDelivery mailet. It's worked fine for years.  But I don't want
> to repeat that moving forward to 3.3+. And the remoteDelivery logic has
> changed in 3.3.  So it doesn't appear my hack would still work anyway.  
> But I still need the function.  I would like to add a hook or listener
> externally without having to build it into a custom James build if
> possible. I've been looking into HookResultLogger and
> CoreCmdHandlerLogger. But I don't see a way to register an additional
> logger short of changing the core code.
> 
> So... my question is: what is the best way to add a logger at the point
> where the outbound transfer has just completed?  If it requires
> modification to the core James code, I have no problem creating a custom
> build.  I just need advice as to where to do the surgery and what the
> recommended solution is in the opinion of the experienced James team.
> 
> Thanks,
> 
> Jerry
> 
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: server-dev-unsubscribe@james.apache.org
> For additional commands, e-mail: server-dev-help@james.apache.org
> 

---------------------------------------------------------------------
To unsubscribe, e-mail: server-dev-unsubscribe@james.apache.org
For additional commands, e-mail: server-dev-help@james.apache.org