Skip to main content

asyncio SMTP client

Project description

"aiosmtplib TravisCI build status"


Introduction

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)
loop.run_until_complete(smtp.connect())

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

loop.run_until_complete(send_a_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:

sender

The address sending this mail.

recipients

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

message

The message string to send.

mail_options

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

rcpt_options

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 details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

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

Uploaded Python 3

File details

Details for the file aiosmtplib-0.1.7.tar.gz.

File metadata

  • Download URL: aiosmtplib-0.1.7.tar.gz
  • Upload date:
  • Size: 14.8 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No

File hashes

Hashes for aiosmtplib-0.1.7.tar.gz
Algorithm Hash digest
SHA256 a8c11321e72152aca6e9d646f2568f238dafb157302208948b69e430e7bc6170
MD5 757ac5625a6e1d0245e29d35867eb6bf
BLAKE2b-256 af4fc32c0c3cb4a3987a36ce5eebab7c09ee3bb792952f08acf609b346c81c57

See more details on using hashes here.

File details

Details for the file aiosmtplib-0.1.7-py3-none-any.whl.

File metadata

File hashes

Hashes for aiosmtplib-0.1.7-py3-none-any.whl
Algorithm Hash digest
SHA256 4be7b3297a47f98676b61052ede07bc3162791a5492a9181da5f772935cbb807
MD5 aae2b3103255b243e03b67a671cf1894
BLAKE2b-256 03479c96cf20d8b47c41a24f9a51cf01661354f35d10844cab4fd14609bd6b59

See more details on using hashes here.

Supported by

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