email_proto is a Python library that provides sans i/o implementations of email protocols.
It also provides reference implementations with i/o.
Download from here?
NOTE: The unittests require that you install all supported async i/o backends pip install anyio curio trio
, but these aren't dependencies of this project itself, only if you want to use those i/o backends.
(Hopefully this can get hosted on pip someday)
import getpass
import from email_proto.smtp_socket import Client # reference synchronous sockets implementation
client = Client()
client.connect ( 'smtp.yourdomain.com', 465, tls = True )
client.helo ( 'localhost' )
client.auth ( '[email protected]', getpass.getpass ( 'Password:' ) )
client.mail_from ( '[email protected]' )
client.rcpt_to ( '[email protected]' )
client.data ( b'(email content here)' )
client.quit()
__init__
.py: only defines project versionsmtp_proto.py
: SMTP protocol implementation sans i/osmtp_sync.py
: reference sync wrapper ofsmtp_proto.py
smtp_async.py
: reference async wrapper ofsmtp_proto.py
smtp_socket.py
: reference sync implementation ofsmtp_sync.py
usingsocket.socket
smtp_aio.py
: reference async implementation ofsmtp_async.py
usingasyncio.StreamReader
/asyncio.StreamWriter
smtp_trio.py
: reference async implementation ofsymtp-async.py
usingtrio.abc.Stream
*_test.py
: unit teststest.*
: tools to make running the tests easier
STARTTLS implementation in asyncio is WIP. It is untested and feels dirty.
Pull requests are welcome. For major changes, please open an issue first to discuss what you would like to change.
Please make sure to update tests as appropriate.
- 0.1.0 - smtp_proto.py 100% code coverage via unittests
- 0.0.9 - smtp believed feature complete with respect to "minimum" required implementation as defined by RFC.
- 0.0.1 - initial design & development
- 0.2.0 - pop3 protocol 100% code coverage via unittests
- 0.4.0 - imap protocol 100% code coverage via unittests
- 1.0 - stable api