Skip to content

Commit

Permalink
fix(catchall-header): ZMS-184 (#49)
Browse files Browse the repository at this point in the history
* in case of catchall address, add custom header to read the original recipient

* make header configurable

* fix typo
  • Loading branch information
NickOvt authored Dec 23, 2024
1 parent 91745b5 commit 6ca9d00
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 0 deletions.
2 changes: 2 additions & 0 deletions config/wildduck.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -100,3 +100,5 @@ auth:

# If a public key has fewer bits than required, then DKIM and ARC keys are considered failing by policy
minBitLength: 1024

originalRcptHeader: 'X-Zone-Original-Rcpt'
6 changes: 6 additions & 0 deletions index.js
Original file line number Diff line number Diff line change
Expand Up @@ -790,6 +790,12 @@ exports.real_rcpt_handler = function (next, connection, params) {
return hookDone(err);
}

if (addressData.address.includes('*')) {
// wildcard/catchall address received email
const originalRcptHeaderName = plugin.cfg?.originalRcptHeader || 'X-Original-Rcpt';
txn.add_header(originalRcptHeaderName, address);
}

if (addressData && addressData.targets) {
return plugin
.handle_forwarding_address(connection, address, addressData)
Expand Down

0 comments on commit 6ca9d00

Please sign in to comment.