Python email libraries

Updated Nov 2026

Python email libraries send messages through an SMTP server or an email provider's HTTP API. A provider SDK sends each message as an API request rather than through an SMTP connection to a mail server. These libraries let apps send sign-up confirmations, password resets, and receipts.

Popularity

SendGrid has the most monthly downloads among the dedicated email libraries in this comparison, at 24.2M.

LibraryMonthly downloadsStarsLast releaseLicense
boto3
2.5B
9.9KNov 2026Apache-2.0
Django
52.2M
91.8KNov 2026BSD-3-Clause
SendGrid
24.2M
1.6KSep 2025MIT
Resend
15.1M
133Nov 2026MIT
aiosmtplib
13.0M
438Sep 2026MIT
Anymail
4.0M
1.9KSep 2026BSD-3-Clause
Azure Communication Email
3.8M
5.6KOct 2025MIT
Flask-Mail
1.4M
644May 2024BSD-3-Clause
Downloads: PyPI, last thirty days. Stars and releases: GitHub. Amber: no release in over a year.

Libraries and code examples

Provides the AWS SDK for Python.

Downloads / mo
2.5B
Stars
9.9K
Last release
1.44.6
License
Apache-2.0

Quickstart

From send_email.html
$ python -m pip install boto3
import boto3

ses = boto3.client("sesv2", region_name="us-east-1")
response = ses.send_email(
    FromEmailAddress="sender@example.com",
    Destination={"ToAddresses": ["recipient@example.com"]},
    Content={"Simple": {"Subject": {"Data": "Hello"},
                        "Body": {"Text": {"Data": "Hello from SES"}}}},
)

Provides a high-level Python web framework for rapid development.

Downloads / mo
52.2M
Stars
91.8K
Last release
6.1.3
License
BSD-3-Clause

Quickstart

From email.txt
$ python -m pip install django
from django.core.mail import send_mail

send_mail(
    "Subject here",
    "Here is the message.",
    "from@example.com",
    ["to@example.com"],
)

Django examples

From open-source projects on GitHub

Provides the Twilio SendGrid library for Python.

Downloads / mo
24.2M
Stars
1.6K
Last release
6.12.5
License
MIT

Quickstart

From README.rst
$ python -m pip install sendgrid
import os
from sendgrid import SendGridAPIClient
from sendgrid.helpers.mail import Mail

client = SendGridAPIClient(os.environ["SENDGRID_API_KEY"])
response = client.send(Mail(
    from_email="from@example.com", to_emails="to@example.com",
    subject="Hello", html_content="<strong>Hello from SendGrid</strong>",
))

SendGrid examples

From open-source projects on GitHub

Provides the Python SDK for Resend.

Downloads / mo
15.1M
Stars
133
Last release
2.55.0
License
MIT

Quickstart

From README.md
$ python -m pip install resend
import os
import resend

resend.api_key = os.environ["RESEND_API_KEY"]
email = resend.Emails.send({
    "from": "onboarding@resend.dev", "to": ["delivered@resend.dev"],
    "subject": "Hello", "html": "<strong>Hello</strong>",
})

Resend examples

From open-source projects on GitHub

Provides an SMTP client for Python asyncio applications.

Downloads / mo
13.0M
Stars
438
Last release
5.1.3
License
MIT

Strengths

  • Provides awaited SMTP operations. Await connection setup, authentication, and message submission from async application code.
  • Automatically upgrades advertised STARTTLS connections. Leave automatic upgrades enabled when the server advertises STARTTLS support.

Limitations

  • One connection sends sequentially. Split email across multiple connections for concurrent submission.
  • Implicit TLS differs from STARTTLS. Use use_tls only for servers accepting TLS from the connection’s start.

Quickstart

From usage.html
$ python -m pip install aiosmtplib
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=1025))

aiosmtplib examples

From open-source projects on GitHub

Adds Django email backends and webhooks for transactional email providers such as Amazon SES, Mailgun, Postmark, and SendGrid.

Downloads / mo
4.0M
Stars
1.9K
Last release
15.2
License
BSD-3-Clause

Quickstart

From message.py
$ python -m pip install django-anymail
from anymail.message import AnymailMessage

message = AnymailMessage(
    subject="Hello", body="Hello from Anymail",
    from_email="sender@example.com", to=["recipient@example.com"],
)
message.send()

Anymail examples

From open-source projects on GitHub

Azure Communication Email

Provides a Microsoft Azure client library for Python.

Downloads / mo
3.8M
Stars
5.6K
Last release
1.1.0
License
MIT

Quickstart

From README.md
$ python -m pip install azure-communication-email
import os
from azure.communication.email import EmailClient

client = EmailClient.from_connection_string(os.environ["COMMUNICATION_CONNECTION_STRING"])
poller = client.begin_send({
    "senderAddress": "sender@contoso.com",
    "content": {"subject": "Hello", "plainText": "Hello from Azure"},
    "recipients": {"to": [{"address": "recipient@example.com"}]},
})

Azure Communication Email examples

From open-source projects on GitHub

Sends email from Flask applications.

Downloads / mo
1.4M
Stars
644
Last release
0.10.0
License
BSD-3-Clause

Quickstart

From index.md
$ python -m pip install flask-mail
from flask import Flask
from flask_mail import Mail, Message

app = Flask(__name__)
app.config.update(MAIL_SERVER="localhost", MAIL_PORT=25)
mail = Mail(app)
with app.app_context():
    mail.send(Message("Hello", sender="from@example.com",
                      recipients=["to@example.com"], body="Hello from Flask"))

Flask-Mail examples

From open-source projects on GitHub

FAQ

aiosmtplib suits asyncio applications that send through an SMTP server. SendGrid and Resend suit apps that send through a provider's HTTP API. Anymail suits Django projects that may switch providers.

The built-in smtplib module sends a message through any SMTP server. Provider SDKs such as SendGrid and Resend send the same message as an HTTP request to the provider's email API.

smtplib is the SMTP client in the Python standard library. aiosmtplib does the same job with asyncio coroutines for connection, authentication, TLS, and sending.

Build a message with the SendGrid Mail helper and send it through the SDK client. The client calls the SendGrid email API.

Django sends multipart email through configurable mail backends. Anymail adds backends and webhooks for transactional email providers such as Mailgun, Postmark, and SendGrid.

For coding agents

Found your email library? Help your agent use it.

Connect Exa so your coding agent can find the library’s documentation, check its API, and look up implementations while you build.

Run in your terminal

claude plugin install exa@claude-plugins-official