From d091b865c7a22cfe6ce7e3f7c309f714cbfb7652 Mon Sep 17 00:00:00 2001 From: link2xt Date: Sat, 4 Oct 2025 02:47:07 +0000 Subject: [PATCH] fix: ignore all RCPT TO: parameters Stalwart sends `NOTIFY=DELAY,FAILURE` to request Delivery Status Notifications. aiosmtpd does not support any parameters, not just ORCPT, so we have to ignore all of them. --- CHANGELOG.md | 3 +++ chatmaild/src/chatmaild/filtermail.py | 12 +++++++----- 2 files changed, 10 insertions(+), 5 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index e9047df2..cf4e23d3 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -2,6 +2,9 @@ ## untagged +- Ignore all RCPT TO: parameters + ([#651](https://github.com/chatmail/relay/pull/651)) + - Use max username length in newemail.py, not min ([#648](https://github.com/chatmail/relay/pull/648)) diff --git a/chatmaild/src/chatmaild/filtermail.py b/chatmaild/src/chatmaild/filtermail.py index f8d755a9..474d7a88 100644 --- a/chatmaild/src/chatmaild/filtermail.py +++ b/chatmaild/src/chatmaild/filtermail.py @@ -197,11 +197,13 @@ class HackedController(Controller): class SMTPDiscardRCPTO_options(SMTP): def _getparams(self, params): - # aiosmtpd's SMTP daemon fails to handle a request if there are RCPT TO options - # We just ignore them for our incoming filtermail purposes - if len(params) == 1 and params[0].startswith("ORCPT"): - return {} - return super()._getparams(params) + # Ignore RCPT TO parameters. + # + # Otherwise parameters such as `ORCPT=...` + # or `NOTIFY=DELAY,FAILURE` (generated by Stalwart) + # make aiosmtpd reject the message here: + # + return {} class OutgoingBeforeQueueHandler: