Re: Catch-all handling - current best practices

Benoit TELLIER <[email protected]> Wed, 21 Aug 2024 11:57:43 +0000
Newsgroups gmane.comp.jakarta.james.user
Message-ID <[email protected]>
Hello Wojtek

So the exact need would be

    GIVEN a mail to [email protected]
    THEN after the bounce the emails ends up in [email protected] mailbox

Pros: it enables a review by the admin using standard IMAP tools
Cons: it is stripped of the SMTP envelope (delivery context) thus can hardly be re-sent. Redelivering them 100% of the time right will be hard. MailRepositories keep the delivery context and allows for this natively.

TLDR the current best practice is to rely on the mailrepository...
While in a single domain setup Forward, Resent and friends likely can do the job they are overly complex with subtile differences and I would not personnaly use them...

If asked I would rather implement something like:


> <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="SetRecipient">
>         <recipient>[email protected]</recipient>>     </mailet>
>     <mailet match="All" class="LocalDelivery"/>
> </processor>
(UNIX philosophy: provide unitary, simple mailet that do one job and one and can be combined....)

For the multi-hosting scenario I bet a SetRecipientLocalPart mailet could make sense.

GIVEN configured with local part catch-all 
WHEN it processes [email protected], [email protected] and [email protected]
THEN it rewrites recipients to [email protected] and [email protected]

Those two mailets are simple enough and generic enough IMO to lend in mailet/standard might they solve your use case.-- 

Best regards,

Benoit TELLIER

General manager of Linagora VIETNAM.
Product owner for Team-Mail product.
Chairman of the Apache James project.

Mail: [email protected]
Tel: (0033) 6 77 26 04 58 (WhatsApp, Signal)


On Aug 21, 2024 11:44 AM, from Wojtek Digging more into it, one could use Forward with `forwardto`, Resend with `to` or Redirect with `to` 
but the problem I see - they all require configuring full email address instead of specifying only 
username, which could be somewhat problematic on installations with multiple domains.

Is there a mailet or a configuration that would allow specifying only local mailbox name instead of 
full email?

Wojtek

On 21/08/2024 11:12, Wojtek wrote:
> Hi all,
> what is the current best practices to add handling of "catch all" use case (i.e. redirect all 
> messages that do not match - and only those that doesn't match! - existing mailbox to "catch all" 
> mailbox)?
> 
> I found cwiki.apache.org/confluence/display/JAMES2/ConfigureJamesAsCatchAll but it's from 5 
> years ago and doesn't even mention version. From the looking at it, it would redirect all messages 
> to "catch-all".
> 
> OTOH I found github.com/foilen/james-extra-components but it hasn't been update since 5 
> years as well.
> 
> Currently we have:
> ```xml
> <processor state="transport" enableJmx="true">
> …
>      <mailet match="HostIsLocal" class="ToProcessor">
>          <processor>local-address-error</processor>
>          <notice>550 - Requested action not taken: no such user here</notice>
>      </mailet>
> …
> </processor>
> 
> <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>
> </processor>
> ```
> 
> I would assume that changing last mailet (ToRepository with error repository) to some mailet. I 
> looked a the list and mailets in the sources but none of them seems to fit it.
> 
> Any suggestion how to configure it?
> 


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]