Sending HELO or EHLO more then once causes smtpd.SMTPChannel to respond with b'503 Duplicate HELO/EHLO\r\n' (see Lib/test/test_smtpd.py:124 for an example). My interpretation of RFC 821, section 4.1.1.5 is that multiple HELO commands are fine outside a mail transaction and a second HELO is eauivalent to a RSET during a mail transaction (undoing any changes made by previous greetings). I would propose to reject greetings during mail transactiond (thats what RSET is for) and else accept them. The question is how we should handle backwards compatibility here. I am willing to work on this right after #21725.
I don't have much interest in working on this for smtpd.py any more. We have an asyncio-based version that's much better, albeit Python 3 only. https://github.com/aio-libs/aiosmtpd This same issue is open over there; if you're still interested in this, maybe take a look at contributing a fix for aiosmtpd. https://github.com/aio-libs/aiosmtpd/issues/78
This is now fixed in aiosmtpd HEAD (what will be 1.1) I'm going to close this issue here even though smtpd.py isn't fixed since it's unlikely that anybody wants to keep working on smtpd.py. Feel free to reopen it if you do.
History
Date
User
Action
Args
2022-04-11 14:58:05
admin
set
github: 65982
2017-06-03 20🔞01
barry
set
status: open -> closedresolution: wont fixmessages: + stage: resolved