SendGrid

raw JSON →
6.12.5 verified Tue May 12 auth: yes python install: verified quickstart: verified maintenance

Official Python SDK for the Twilio SendGrid Email API v3. Owned by Twilio. Two send patterns exist: Mail helper class and raw dict. v6.x is a breaking change from v5.x. Free plan retired May 2025. SDK last meaningfully updated Sep 2025 — in maintenance mode.

pip install sendgrid
breaking v6.x is a breaking change from v5.x. The SendGridAPIClient constructor signature changed, and the send pattern via sg.client.mail.send.post() requires a raw dict, not the old Mail object's .get() call in some patterns.
fix Upgrade to v6 and use Mail helper class with sg.send(message) or pass raw dict to sg.client.mail.send.post(request_body=data).
gotcha 202 Accepted does not mean delivered. SendGrid queues emails and delivers asynchronously. Checking response.status_code == 200 will always fail — the success code is 202.
fix Check response.status_code == 202 for success. Use Event Webhooks for delivery/bounce/open tracking.
gotcha The from_email must be a verified sender (Single Sender Verification) or from a domain with Domain Authentication set up. Sending from unverified addresses returns 403 Forbidden.
fix Complete Domain Authentication in SendGrid dashboard, or verify the specific sender address via Single Sender Verification.
gotcha SendGrid Free plan was retired May 27, 2025. New accounts can no longer use the free tier after this date. Existing free accounts had 60 days before billing required.
fix For free email sending, consider Resend (100/day free) or Postmark (100/month free). For existing SendGrid integrations, upgrade to a paid plan.
gotcha SDK GitHub repository last updated September 2025. The library is in maintenance mode — new SendGrid features may not be reflected in the SDK. Use sg.client._('endpoint').post(request_body=data) for endpoints not in the helper.
fix For new SendGrid features, use the low-level client: sg.client._(endpoint).method(request_body=data).
gotcha The test environment generated pip warnings about running as the 'root' user and an available update.
fix It is recommended to use a virtual environment for pip operations to avoid permission issues. Additionally, pip can be updated by running `pip install --upgrade pip`.
python os / libc status wheel install import disk
3.10 alpine (musl) - - 0.17s 36.4M
3.10 slim (glibc) - - 0.12s 37M
3.11 alpine (musl) - - 0.28s 38.9M
3.11 slim (glibc) - - 0.23s 39M
3.12 alpine (musl) - - 0.23s 30.6M
3.12 slim (glibc) - - 0.23s 31M
3.13 alpine (musl) - - 0.20s 30.2M
3.13 slim (glibc) - - 0.23s 31M
3.9 alpine (musl) - - 0.17s 36.7M
3.9 slim (glibc) - - 0.16s 37M

202 Accepted means queued for delivery, not delivered. The from_email must be a verified sender or from a verified domain.

import os
from sendgrid import SendGridAPIClient
from sendgrid.helpers.mail import Mail

message = Mail(
    from_email='sender@example.com',
    to_emails='recipient@example.com',
    subject='Sending with SendGrid',
    html_content='<strong>Hello from Python!</strong>'
)

try:
    sg = SendGridAPIClient(os.environ.get('SENDGRID_API_KEY'))
    response = sg.send(message)
    print(response.status_code)  # 202 = accepted
except Exception as e:
    print(str(e))