test(web-app-stalwart): require the relay denial code in the CLI probe

The unauthenticated half of the relay probe passed on any 5xx answer.
A server that refused the recipient for another reason would have
counted as "relay denied". It now requires 550, the code Stalwart gives
for a denied relay.

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
This commit is contained in:
kevinveenbirkenbachandClaude Opus 5.5 committed 2026-10-08 19:27:27 +02:00
1 parent 7aeed796c8
commit 65a884beba
1 file changed
+4 -3
@@ -41,6 +41,7 @@ TIMEOUT = 60
MAILBOXES = ("INBOX", "Junk Mail")
EXTERNAL_RECIPIENT = "relay-probe@example.org"
RELAY_DENIED = 550
def unverified_context() -> ssl.SSLContext:
@@ -62,10 +63,10 @@ def relay(host: str, sender: str, password: str) -> int:
smtp.ehlo()
smtp.mail(sender)
anonymous, _ = smtp.rcpt(EXTERNAL_RECIPIENT)
if anonymous < 500:
if anonymous != RELAY_DENIED:
print(
f"open relay: an unauthenticated session got {anonymous} "
f"for {EXTERNAL_RECIPIENT}",
f"relay not denied: an unauthenticated session got {anonymous} "
f"for {EXTERNAL_RECIPIENT}, expected {RELAY_DENIED}",
file=sys.stderr,
)
return 1