freshcrate
Home > Frameworks > aiosmtplib

aiosmtplib

asyncio SMTP client

Description

aiosmtplib ========== |circleci| |precommit.ci| |codecov| |zero-deps| |pypi-version| |downloads| |pypi-license| ------------ aiosmtplib is an asynchronous SMTP client for use with asyncio. For documentation, see `Read The Docs`_. Quickstart ---------- .. start quickstart .. code-block:: python import asyncio from email.message import EmailMessage import aiosmtplib message = EmailMessage() message["From"] = "root@localhost" message["To"] = "somebody@example.com" message["Subject"] = "Hello World!" message.set_content("Sent via aiosmtplib") asyncio.run(aiosmtplib.send(message, hostname="127.0.0.1", port=25)) .. end quickstart Requirements ------------ .. start requirements Python 3.10+ is required. .. end requirements Bug Reporting ------------- .. start bug-reporting Bug reports (and feature requests) are welcome via `Github issues`_. .. _Github issues: https://github.com/cole/aiosmtplib/issues .. end bug-reporting .. |circleci| image:: https://circleci.com/gh/cole/aiosmtplib/tree/main.svg?style=shield :target: https://circleci.com/gh/cole/aiosmtplib/tree/main :alt: "aiosmtplib CircleCI build status" .. |pypi-version| image:: https://img.shields.io/pypi/v/aiosmtplib.svg :target: https://pypi.python.org/pypi/aiosmtplib :alt: "aiosmtplib on the Python Package Index" .. |pypi-status| image:: https://img.shields.io/pypi/status/aiosmtplib.svg .. |pypi-license| image:: https://img.shields.io/pypi/l/aiosmtplib.svg .. |codecov| image:: https://codecov.io/gh/cole/aiosmtplib/branch/main/graph/badge.svg :target: https://codecov.io/gh/cole/aiosmtplib .. |downloads| image:: https://static.pepy.tech/badge/aiosmtplib/month :target: https://pepy.tech/project/aiosmtplib :alt: "aiosmtplib on pypy.tech" .. |precommit.ci| image:: https://results.pre-commit.ci/badge/github/cole/aiosmtplib/main.svg :target: https://results.pre-commit.ci/latest/github/cole/aiosmtplib/main :alt: "pre-commit.ci status" .. |zero-deps| image:: https://0dependencies.dev/0dependencies.svg :target: https://0dependencies.dev :alt: "0 dependencies" .. _Read The Docs: https://aiosmtplib.readthedocs.io/en/stable/

Release History

VersionChangesUrgencyDate
5.1.0Imported from PyPI (5.1.0)Low4/21/2026
v5.1.0## What's Changed * Feature: Add XOAUTH2 authentication support **Full Changelog**: https://github.com/cole/aiosmtplib/compare/v5.0.0...v5.1.0Low1/25/2026
v5.0.0## What's Changed * **BREAKING**: Drop Python 3.9 support * Various testing config improvements ## New Contributors * @cjwatson made their first contribution in https://github.com/cole/aiosmtplib/pull/328 **Full Changelog**: https://github.com/cole/aiosmtplib/compare/v4.0.2...v5.0.0Low10/19/2025
v4.0.2## What's Changed * Bugfix: correct aexit signature to comply with async context manager protocol by @oliverlambson in https://github.com/cole/aiosmtplib/pull/323 ## New Contributors * @oliverlambson made their first contribution in https://github.com/cole/aiosmtplib/pull/323 **Full Changelog**: https://github.com/cole/aiosmtplib/compare/v4.0.1...v4.0.2Low9/1/2025
v4.0.1## What's Changed * Bugfix: disconnect outside of command context by @cole in https://github.com/cole/aiosmtplib/pull/313 **Full Changelog**: https://github.com/cole/aiosmtplib/compare/v4.0.0...v4.0.1Low9/1/2025
v4.0.0- **BREAKING**: Drop Python 3.8 support - Bugfix: Run socket.getfqdn in thread to avoid blocking event loop if local_hostname not provided (thanks @Raidzin) - Bugfix: Clear connect lock on connection lost, allowing client reconnect - Bugfix: Allow socket connections to use TLS by providing hostname and use_tls=True **Full Changelog**: https://github.com/cole/aiosmtplib/compare/v3.0.2...v4.0.0Low2/3/2025
v3.0.2- Bugfix: Type of "send" is partially unknown with pyright - Bugfix: Fix asyncio deadlock trying to reconnect after error (thanks @Voldemat) - Change: Switched from Poetry to build/hatch/twine for packaging. **Full Changelog**: https://github.com/cole/aiosmtplib/compare/v3.0.1...v3.0.2Low7/31/2024
v3.0.1- Bugfix: 'Future exception was never retrieved' warning in SMTPProtocol after successful connection close and garbage collection. - Cleanup: Updated FlowControlMixin logic from stdlib **Full Changelog**: https://github.com/cole/aiosmtplib/compare/v3.0.0...v3.0.1Low11/2/2023
v3.0.0- **BREAKING**: Drop Python 3.7 support. - **BREAKING**: Positional arguments are now positional only, and keyword arguments are keyword only. - **BREAKING**: Passing ``source_address`` as a string argument (deprecated in 2.0) is now an error. ``source_address`` takes a (addr, port) tuple that is used as the ``local_addr`` param of ``asyncio.create_connection``, allowing for binding to a specific IP. The ``local_hostname`` argument takes the value to be sent to the server with the EHLO/HELLow11/2/2023
v2.0.2- Bugfix: don't send extra EHLO/HELO before QUIT (credit @ikrivosheev) - Change: added SMTPConnectionResponseError for invalid response on connect only (credit @ikrivosheev) Low6/3/2023
v2.0.1 ## Changes - Bugfix: "tests" and "docs" in the sdist should be includes, not packages, so that they do not get put in ``site-packages``.Low1/7/2023
v2.0.0 - **BREAKING**: Drop Python 3.5 and 3.6 support. - **BREAKING**: On connect, if the server supports STARTTLS, automatically try to upgrade the connection. STARTTLS after connect can be turned on or off explicitly by passing ``start_tls=True`` or ``start_tls=False`` respectively. - **BREAKING**: Remove deprecated ``loop`` keyword argument for the SMTP class. - Change: The ``source_address`` argument now takes a (addr, port) tuple that is passed as the ``local_addr`` param to ``asyncLow10/28/2022
v1.1.7## What's Changed - Security: Fix a possible injection vulnerability (a variant of https://consensys.net/diligence/vulnerabilities/python-smtplib-multiple-crlf-injection/) Note that in order to exploit this vulnerability in aiosmtplib, the attacker would need control of the ``hostname`` or ``source_address`` parameters. Thanks Sam Sanoop @ Snyk for bringing this to my attention. - Bugfix: include CHANGLOG in sdist release - Type hints: fix type hints for async context exit (credLow9/2/2022
v1.1.6- Bugfix: fix authenticated test failures (credit @P-EB)Low5/9/2021
v1.1.5- Bugfix: avoid raising ``asyncio.CancelledError`` on connection lost - Bugfix: allow UTF-8 chars in usernames and password strings - Feature: allow bytes type args for login usernames and passwords Low4/25/2021
v1.1.4- Bugfix: parsing comma separated addresses in to header (credit @gjcarneiro) - Feature: add py.typed file (PEP 561, credit @retnikt)Low9/12/2020
v1.0.2- Bugfix: Close connection lock on on SMTPServerDisconnected - Feature: Added cert_bundle argument to connection init, connect and starttls methods - Bugfix: Disconnected clients would raise SMTPResponseException: (-1 ...) instead of SMTPServerDisconnected Low9/9/2020
v1.0.3- Bugfix: Removed buggy close connection on __del__ - Bugfix: Fixed old style auth method parsing in ESMTP response. - Bugfix: Cleanup transport on exception in connect method. - Cleanup: Simplified SMTPProtocol.connection_made, __main__Low9/9/2020
v1.0.4- Bugfix: Badly encoded server response messages are now decoded to utf-8, with error chars escaped. - Cleanup: Removed handling for exceptions not raised by asyncio (in SMTPProtocol._readline) Low9/9/2020
v1.0.5- Bugfix: Connection is now closed if an error response is received immediately after connecting.Low9/9/2020
v1.0.6- Bugfix: Set default timeout to 60 seconds as per documentation (previously it was unlimited).Low9/9/2020
v1.1.0- Feature: Added send coroutine api. - Feature: Added SMTPUTF8 support for UTF8 chars in addresses. - Feature: Added connected socket and Unix socket path connection options. - Feature: Wait until the connect coroutine is awaited to get the event loop. Passing an explicit event loop via the loop keyword argument is deprecated and will be removed in version 2.0. - Cleanup: Set context for timeout and connection exceptions properly. - Cleanup: Use built in start_tls method on Low9/9/2020
v1.1.1- Bugfix: Fix handling of sending legacy email API (Message) objects. - Bugfix: Fix SMTPNotSupported error with UTF8 sender/recipient names on servers that don't support SMTPUTF8.Low9/9/2020
v1.1.2- Bugfix: removed ``docs`` and ``tests`` from wheel, they should only be in the source distribution. Low9/9/2020
v1.1.3- Feature: add pause and resume writing methods to ``SMTPProcotol``, via ``asyncio.streams.FlowControlMixin`` (thanks @ikrivosheev). - Bugfix: allow an empty sender (credit @ikrivosheev) - Cleanup: more useful error message when login called without TLSLow9/9/2020
v1.0.0Initial feature complete release with stable API.Low4/7/2017
v1.0.1- Commands were getting out of order when using the client as a context manager within a task - multiple tasks calling connect would get confused - EHLO/HELO responses were being saved even after disconnect - RuntimeError on client cleanup if event loop was closed - CRAM-MD5 auth was not working - AttributeError on STARTTLS under uvloopLow4/7/2017

Dependencies & License Audit

Loading dependencies...

Similar Packages

python-socksProxy (SOCKS4, SOCKS5, HTTP CONNECT) client for Python2.8.1
txaioCompatibility API between asyncio/Twisted/Trollius25.12.2
autobahnWebSocket client & server library, WAMP real-time framework25.12.2
resendResend Python SDK2.29.0
greenbackReenter an async event loop from synchronous code1.3.0