The Python standard library once included a basic SMTP server in the smtpd module, based on the old asynchronous libraries asyncore and asynchat. It was formally removed in v3.12.
This package provides such an implementation of both the SMTP and LMTP protocols using the asyncio module (which has been standard since Python v3.4). Supports the relevant RFCs natively.
Can be executed from the command line, defaulting to port 8025/tcp: python3 -m aiosmtpd -n
or aiosmtpd -n