aiosmtplib is an asynchronous SMTP client for use with asyncio.
For documentation, see Read The Docs.
import asyncio
from email.message import EmailMessage
import aiosmtplib
message = EmailMessage()
message["From"] = "root@localhost"
message["To"] = "[email protected]"
message["Subject"] = "Hello World!"
message.set_content("Sent via aiosmtplib")
loop = asyncio.get_event_loop()
loop.run_until_complete(aiosmtplib.send(message, hostname="127.0.0.1", port=25))
Python 3.5.2+, compiled with SSL support, is required.
Bug reports (and feature requests) are welcome via Github issues.