You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
In this commit I've completely rewritten the smtp.Server class using
aiosmtpd instead of Python's standard smtpd module, which is deprecated
and scheduled for removal in Python 3.12.
Migrating the main functionality to aiosmtpd is intrinsically not hard;
it just required creating the Handler class, which is about ten lines
and can be used as-is with aiosmtpd.controller.Controller. The rest of
the changes here are to reproduce the interface of the existing Server
class well enough to pass the tests. We've been testing some features of
the Server class which don't exactly have equivalents in aiosmtpd, so I
had to use some wrappers and hacks to offer the same interface: for
example, I reimplemented the Server.stop() method to make it idempotent
and accept a timeout argument, and I had to use some private attributes
of Controller to make Server.is_alive() and Server.accepting behave
the way they used to.
I also added some additional hacks to support older versions of aiosmtpd
that work with Python 3.5. In retrospect, that probably wasn't worth it,
but I started trying to do it without realizing how much work it'd be,
and once the work was done, I figured I might as well keep it. We should
definitely drop support for Python 3.5 soon, though, and that will
simplify the implementation.
0 commit comments