Purpose: send all incoming mail to non-existing addresses to a central account.

I added corrections, commentary and screenshots to the code I found at http://www.qtzar.com/dlyh-5mnlz8/. The code parts are licensed under the Apache 2.0 license. The non-code part of qtzar’s page is licensed under the Creative Commons Attribution 3.0 Unported (CC BY 3.0) license and so this code and this article, respectively, are too.

By default, undeliverable mail will just be discarded. We need to keep it in order to do stuff with it.

In IBM Domino Administrator connect to the server. In the left pane expand Messaging and choose Configurations. In the right pane click Edit Configuration.

 

Choose Router/SMTP > Advanced > Controls and set Hold undeliverable mail to Enabled.

 

Now we’ll create an agent to go through the undeliverable mail and reroute it to our catch-all address.

Open MAIL.BOX on which to check for wrongly addressed e-mail.
From the Create menu select Agent

 
Set the type to Formula

 
In the Object pane select Document Selection. In the right pane click Add Condition

 
In the Add Condition window:
Condition: By field
Field: FailureReason contains
Value: User
Click Add.

 
Click Add Condition
Condition: By field
Field: FailureReason contains
Value: “not listed in Domino Directory”
Click Add.

 
In the Objects pane select Action. In the right pane paste:

FIELD RoutingState := "";
FIELD Recipients := "catch-all@example.com";
FIELD SaveOptions := @Unavailable;
FIELD Form := @If(@IsAvailable(MailSavedForm) & MailSavedForm!="";MailSavedForm;"Memo");
FIELD $Hops := 25;
SELECT RoutingState = "HOLD"

Note: some text editors/content management systems replace the double quotes with so called ‘smart quotes’ which break the code. If that happens replace all smart quotes with regular double quotes: the ones your keyboard produces.

If it isn’t visible yet open the Agent Properties window by right-clicking on an empty place in the right pane and selecting Agent Properties.

 
In the Name field type Catch-all and close the Agent Properties windows.

 

Set Trigger to On schedule, More than once a day

 
Click the Schedule button and set an appropriate schedule.

 

Close the tab to save the agent. Domino will ask if you want to save it.