Skip to main content

asyncio version of smtplib

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.6.tar.gz (14.1 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.6-py3-none-any.whl (18.7 kB view details)

Uploaded Python 3

File details

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

File metadata

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

File hashes

Hashes for aiosmtplib-0.1.6.tar.gz
Algorithm Hash digest
SHA256 65220088f624f515b5730402ef5ad9d723f75dd8020d1ab99d953c7e644b95f1
MD5 f9229e2133f298eac9216af99b9c121d
BLAKE2b-256 2147101b9587687e41102b84bd87be7133352922bc46a95581d8f522d0b2c8b2

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for aiosmtplib-0.1.6-py3-none-any.whl
Algorithm Hash digest
SHA256 60ee6f783c60c727a2044762935adaf3588728b9bfbaa078b51cda02967a0928
MD5 0064fb5ef2390cae75796d4eae5bbf2e
BLAKE2b-256 b8544b40453cb4621e4db03d917499b9a8e1c43008168669cefa98c011d74e4b

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