LMTP Defect handling defective
Moved from HyperKitty, where I inadvertently mis-reported.
If a received message has a 'defect' as reported in https://docs.python.org/2/library/email.errors.html, LMTP reports '501 Message has defects' and rejects it, believing it to be SPAM. However, it can also be an MTA issue.
There are 6 different defect types. Knowing the actual exception that is raised would be helpful for debugging issues.
I don't see any problem with reporting this as part of the 501 response text, but at least it should be logged.
The 6 defect classes are:
- NoBoundaryInMultipartDefect
- StartBoundaryNotFoundDefect
- FirstHeaderLineIsContinuationDefect
- MisplacedEnvelopeHeaderDefect
- MalformedHeaderDefect
- MultipartInvariantViolationDefect
These map to mail.errors.<exception_name>