Skip to main content

Instantiation

See Authentication for both approaches.

Composing a message

Use the Mail helper to compose messages. It handles formatting and automatically base64-encodes HTML content before sending.
Call mail.get() to get the formatted dict ready for the API.

Attachments

Pass attachments via the optional_headers dict:

Send a message

Check delivery status

Common deliveryStatus values: delivered, opened, failed, pending.

Scheduled send

Schedule a message for future delivery, check its status, reschedule, or cancel it.

Schedule a message

scheduled_at must be an ISO 8601 UTC datetime string in the future and within 30 days.

Get scheduled message status

Reschedule a message

Cancel a scheduled message

The Response object

Both send and get return a Response object:

Error handling

Both methods raise requests.exceptions.HTTPError on non-2xx responses. Wrap calls in a try/except block:
The optional handle_error helper prints the error response body before re-raising: