Invalid email domain not handled properly and showing a 451
Author: thohaiCreated Jul 1, 2026Updated Jul 1, 2026
Hey! When somebody using my mailu server (version 2024.06 - latest) tried to send an email to emaildomain containing an "_" (yes this is an invalid address).
Mailu responded with:
Transcript of session follows.
Out: 220 srv.my.redacted ESMTP Postfix
In: EHLO srv.my.redacted
Out: 250-srv.my.redacted
Out: 250-SIZE 50000000
Out: 250-VRFY
Out: 250-ETRN
Out: 250-AUTH PLAIN LOGIN
Out: 250-ENHANCEDSTATUSCODES
Out: 250-8BITMIME
Out: 250-DSN
Out: 250-SMTPUTF8
Out: 250 CHUNKING
In: MAIL FROM: [<[email protected]>](mailto:[email protected])
Out: 250 2.1.0 Ok
In: RCPT TO: [<recipient@invalid_example.ex>](mailto:recipient@invalid_example.ex)
Out: 250 2.1.5 Ok
In: DATA
Out: 354 End data with <CR><LF>.<CR><LF>
Out: 451 4.3.0 Error: queue file write error
In: QUIT
Out: 221 2.0.0 Bye
For other details, see the local mail logfileI would have expected a different error code or error message when the recipient email domain is invalid.
Either the email is rejected because of the special character that should not be there OR it shold be rejected because the domain is invalid - but it seems it failed earlier because it tries to write a filename with that character.
Is it maybe the case that the underscore is not properly escaped here?
Source: Mailu/Mailu