This is an automated email from the ASF dual-hosted git repository.

Arsnael pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/james-project.git

commit c3ad68ab9ce3da317fe2b2a551b89d5cf1272bc7
Author: Felix Auringer <[email protected]>
AuthorDate: Tue Jul 14 17:18:16 2026 +0200

    docs: add documentation for the new checks in ValidRcptHandler
---
 .../servers/partials/configure/smtp-hooks.adoc     | 27 +++++++++++++++-------
 .../spring-app/src/main/resources/smtpserver.xml   | 21 +++++++++++------
 2 files changed, 33 insertions(+), 15 deletions(-)

diff --git a/docs/modules/servers/partials/configure/smtp-hooks.adoc 
b/docs/modules/servers/partials/configure/smtp-hooks.adoc
index 5028910546..3e7e77cc30 100644
--- a/docs/modules/servers/partials/configure/smtp-hooks.adoc
+++ b/docs/modules/servers/partials/configure/smtp-hooks.adoc
@@ -328,23 +328,34 @@ Example configuration:
 
 == ValidRcptHandler
 
-With ValidRcptHandler, all email will get rejected which has no valid user.
+The ValidRcptHandler rejects all emails for which this email server does not 
handle the recipient.
 
-You need to add the recipient to the validRecipient list if you want
-to accept email for a recipient which not exist on the server.
+In any case, recipients for which a mailbox exists locally are accepted.
+Additionally, recipients with a valid entry in the RRT are accepted.
+This behavior can be disabled by setting the option 
`enableRecipientRewriteTable` to `false`. It is `true` by default.
 
-If you want James to act as a spamtrap or honeypot, you may comment 
ValidRcptHandler
-and implement the needed processors in spoolmanager.xml.
+If the RRT is enabled, there are three options how to check it.
+The desired option can be set with `recipientRewriteTableCheck` and must be 
one of the following:
 
-This handler should be considered stable.
+- `mappingExists` (default): The RRT must contain at least one mapping from 
the recipient. It may point to a mailbox on another email server or to a 
non-existing local mailbox. It may also be a mapping of type error.
+- `anyMappingValid`: After resolving the recipient using the RRT, at least one 
target must be an existing local mailbox. This ignores error mappings.
+- `allMappingsValid`: After resolving the recipient using the RRT, every 
target must be an existing local mailbox. If there is an error mapping, the 
check fails.
 
-Example configuration:
+Note that the last option completely forbids aliases to mailboxes on other 
email servers.
+Depending on your configuration of the recipient rewrite table, the recipient 
is resolved recursively.
+
+This handler is considered stable.
+
+Example configuration with default values:
 
 [source,xml]
 ....
 <handlerchain>
     <!-- ... -->
-    <handler class="org.apache.james.smtpserver.fastfail.ValidRcptHandler"/>
+    <handler class="org.apache.james.smtpserver.fastfail.ValidRcptHandler">
+        <enableRecipientRewriteTable>true</enableRecipientRewriteTable>
+        <recipientRewriteTableCheck>mappingExists</recipientRewriteTableCheck>
+    </handler>
 </handlerchain>
 ....
 
diff --git a/server/apps/spring-app/src/main/resources/smtpserver.xml 
b/server/apps/spring-app/src/main/resources/smtpserver.xml
index 9f8cd619d7..69c2795972 100644
--- a/server/apps/spring-app/src/main/resources/smtpserver.xml
+++ b/server/apps/spring-app/src/main/resources/smtpserver.xml
@@ -226,14 +226,21 @@
             <!--
             <handler 
class="org.apache.james.smtpserver.fastfail.ValidSenderDomainHandler"/>
              -->
-         
-            <!-- With ValidRcptHandler, all email will get rejected which has 
no valid user -->
-            <!-- You need to add the recipient to the validRecipient list if 
you want -->
-            <!-- to accept email for a recipient which not exist on the server 
-->
-            <!-- If you want James to act as a spamtrap or honeypot, you may 
comment ValidRcptHandler -->
-            <!-- and implement the needed processors in spoolmanager.xml -->
+
+            <!-- The ValidRcptHandler rejects all emails for which this email 
server does not handle the recipient. -->
+            <!-- In any case, recipients for which a mailbox exists locally 
are accepted. -->
+            <!-- Additionally, recipients with a valid entry in the RRT are 
accepted. -->
+            <!-- This behavior can be disabled by setting the option 
`enableRecipientRewriteTable` to `false`. It is `true` by default. -->
+            <!-- If the RRT is enabled, there are three options how to check 
it. -->
+            <!-- The desired option can be set with 
`recipientRewriteTableCheck` and must be one of the following: -->
+            <!-- - `mappingExists` (default): The RRT must contain at least 
one mapping from the recipient. It may point to a mailbox on another email 
server or to a non-existing local mailbox. It may also be a mapping of type 
error. -->
+            <!-- - `anyMappingValid`: After resolving the recipient using the 
RRT, at least one target must be an existing local mailbox. This ignores error 
mappings. -->
+            <!-- - `allMappingsValid`: After resolving the recipient using the 
RRT, every target must be an existing local mailbox. If there is an error 
mapping, the check fails. -->
+            <!-- Note that the last option completely forbids aliases to 
mailboxes on other email servers. -->
+            <!-- Depending on your configuration of the recipient rewrite 
table, the recipient is resolved recursively. -->
+            <!-- This handler is considered stable. -->
             <handler 
class="org.apache.james.smtpserver.fastfail.ValidRcptHandler"/>
-            
+
             <!-- If activated you can limit the maximal recipients -->
             <!-- 
             <handler 
class="org.apache.james.smtpserver.fastfail.MaxRcptHandler">


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

Reply via email to