Skip to main content

asyncio version of smtplib

Project description

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=25, loop=loop)

@asyncio.coroutine
def send_a_message():
    sender = 'root@localhost'
    recipient = 'somebody@localhost'
    message = "Hello World"
    yield from smtp.sendmail(sender, [recipient], message)

asyncio.async(send_a_message())
loop.run_forever()

Connecting to an SMTP server

Use an instance of the SMTP class to connect to a server. Note that if the event loop used to initialize the class is not currently running, it will be started in order to connect.

Sending messages

Use SMTP.sendmail to send raw messages. The method signature is the same as for standard smtplib.

Use SMTP.send_message to send email.message.Message objects. The method signature is the same as for standard smtplib.

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.2.tar.gz (10.2 kB view details)

Uploaded Source

File details

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

File metadata

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

File hashes

Hashes for aiosmtplib-0.1.2.tar.gz
Algorithm Hash digest
SHA256 4f2f5f258d8f722e5d3de179a59d21583846986d1c5f6f358fbdfe2473baa630
MD5 13bbf23df2de60eaab4c4f7f2456a5fb
BLAKE2b-256 5a392b45ea9e1142fe832cf9a565911bd19c4731972dc6ea064f2ad4628d05b9

See more details on using hashes here.

Supported by

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