Just to make sure, mentioned `SetRecipientLocalPart` and `SetRecipient` are 
suggested mailets - correct?

Wojtek

On 21/08/2024 13:57, Benoit TELLIER wrote:
Hello Wojtek

So the exact need would be

     GIVEN a mail to unkn...@domain.tld
     THEN after the bounce the emails ends up in catch-...@domain.tld 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>catch-...@domain.tld</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 rc...@domain.tld, rc...@domain.tld and rc...@other.com
THEN it rewrites recipients to catch-...@domain.tld and catch-...@other.com

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: btell...@linagora.com
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: server-user-unsubscr...@james.apache.org
For additional commands, e-mail: server-user-h...@james.apache.org





---------------------------------------------------------------------
To unsubscribe, e-mail: server-user-unsubscr...@james.apache.org
For additional commands, e-mail: server-user-h...@james.apache.org

Reply via email to