Skip to main content

asyncio SMTP client

Project description

"aiosmtplib TravisCI build status"


Aiosmtplib is an implementation of the python stdlib smtplib using asyncio, for use in asynchronous applications.

Basic usage:

import asyncio
import aiosmtplib

loop = asyncio.get_event_loop()
smtp = aiosmtplib.SMTP(hostname='localhost', port=1025, loop=loop)

async def send_a_message():
    sender = 'root@localhost'
    recipient = 'somebody@localhost'
    message = "Hello World"
    await smtp.sendmail(sender, [recipient], message)


Connecting to an SMTP server

Initialize a new aiosmtplib.SMTP instance, then run its connect coroutine. Unlike the standard smtplib, initializing an instance does not automatically connect to the server.

Sending messages

Use SMTP.sendmail to send raw messages. Allowed arguments are:


The address sending this mail.


A list of addresses to send this mail to. A bare string will be treated as a list with 1 address.


The message string to send.


List of options (such as ESMTP 8bitmime) for the mail command.


List of options (such as DSN commands) for all the rcpt commands.

Use SMTP.send_message to send email.message.Message objects.

Project details

Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

aiosmtplib-0.1.7.tar.gz (14.8 kB view hashes)

Uploaded Source

Built Distribution

aiosmtplib-0.1.7-py3-none-any.whl (19.4 kB view hashes)

Uploaded Python 3

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page