-
-
Notifications
You must be signed in to change notification settings - Fork 14
Open
Description
It's great to see this project revived!
I'm in a position where I could really do with being able to trigger error responses to certain emails (e.g. '550 Mailbox unavailable' and '421 Service not available') to aid in testing.
I tried to do this myself by adding a handle_RCPT handler into smtp.py's AsyncMessage class:
# If the address contains "smtp_response_nnn", return a suitable response code
async def handle_RCPT(self, server, session, envelope, address, rcpt_options):
if 'smtpresponse_421' in address:
return '421 Service not available'
if 'smtpresponse_550' in address:
return '550 Mailbox unavailable'
envelope.rcpt_tos.append(address)
return '250 OK'This does return the expected SMTP response codes, but now the handle_message handler no longer fires so the message doesn't make it into the DB, and at this point my lack of knowledge of aiosmtpd and async Python becomes very obvious :)
It turns out this does work fine after all.
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
No labels