Registry / communication / sendgrid

sendgrid

JSON →
sdk6.12.5pypypi✓ verified 25d ago

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
INSTALL
IMPORT
SIG · SENDGRID
S
sendgrid
communicationpythonv6.12.5
Install
3.0s avg
Import
199ms
Disk
37MB
Pass rate
10/ 10
Env Coverage10 / 10
glibc
3.93.13
musl
3.93.13
Install & Compatibility
Where this runs
tested against v6.12.5 · pip install
no network on importno background threads
Install × environment matrix
Each cell = how many times install + import succeeded across repeated harness runs. Partial = flaky.
glibc = Debian/Ubuntu slim · musl = Alpine Linux
musl
py 3.103.95 runs
installs and imports cleanly · install 0.0s · import 0.204s · 38.1MB
glibc
py 3.103.95 runs
installs and imports cleanly · install 3.0s · import 0.194s · 39MB
37MB installed
● package 37MB
Code
Verified usage

Verified import paths — ran on the pinned version, not inferred.

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

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))
Debug
Known issues
breakingv6.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).
affects: < 6.0.0
gotcha202 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.
affects: all
gotchaThe 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.
affects: all
gotchaSendGrid 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.
affects: all
gotchaSDK 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).
affects: all
gotchaThe 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`.
affects: all
Upgrade
Version history
6.12.5latest on PyPI · released Sep 19, 2025
Audit
Dependencies
python-http-clientrequiredSendGrid's own HTTP client library. Installed automatically.
starkbank-ecdsarequiredRequired for webhook signature validation.
Agent activity
30 hits · last 30 days
node
24
Amazon
1
OpenAI (training)
1
Resources
sendgrid — pip install sendgrid · libregistry