Skip to main content

serversmtp (Python)

Official Python SDK for the ServerSMTP transactional email API. Python 3.9+, standard library only.

pip install serversmtp
import os
from serversmtp import ServerSMTP, ServerSMTPError

serversmtp = ServerSMTP(os.environ["SERVERSMTP_API_KEY"])

response = serversmtp.emails.send(
    {
        "from": "Shop <orders@your-domain.ro>",
        "to": "customer@example.com",
        "subject": "Order #1001 confirmed",
        "html": "<p>Thank you!</p>",
    },
    idempotency_key="order-1001-confirmation",
)
print(response.data["status"], response.idempotency_key)

Attachments, CC and BCC (up to 10 files, 10 MB in total; each address counts toward the quota):

from serversmtp import attachment_from_path

serversmtp.emails.send({
    "from": "Shop <orders@your-domain.ro>",
    "to": "customer@example.com",
    "cc": "accounting@your-domain.ro",
    "bcc": ["archive@your-domain.ro"],
    "subject": "Invoice #1001",
    "text": "Your invoice is attached.",
    "attachments": [attachment_from_path("invoice-1001.pdf")],
})
  • emails.send(), emails.send_batch(), emails.schedule() (timezone-aware datetime for sendAt)
  • scheduled.list(), scheduled.get(), scheduled.cancel(), verify_api_key()
  • emails.get(request_id), emails.list(limit=, offset=): sent emails with each recipient's status, tags and suppressed addresses
  • Messages accept headers (up to 20 custom headers) and tags (up to 10 {"name", "value"})
  • events.trigger(event, email, data=None, phone=None, audience_id=None) starts the automations for an event (email and SMS steps):
serversmtp.events.trigger("comanda.expediata", "client@example.com",
                          {"order_reference": "1001", "tracking_number": "AWB123"}, phone="0722 123 456")
  • Errors raise ServerSMTPError with status_code, fields, request_id and type.

Docs: https://serversmtp.ro/docs#biblioteci

Metadata

Release files for serversmtp 0.4.0

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for serversmtp 0.4.0
File Size Uploaded Provenance Actions
serversmtp-0.4.0.tar.gz 7.1 kB Without provenance Details for serversmtp-0.4.0.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for serversmtp 0.4.0
File Interpreter ABI Platform Actions
serversmtp-0.4.0-py3-none-any.whl Python 3 none any Details for serversmtp-0.4.0-py3-none-any.whl

Total release size: 12.2 kB

Release files / serversmtp-0.4.0.tar.gz

Download URL serversmtp-0.4.0.tar.gz
Size 7.1 kB
Tags Source
SHA-256 checksum
How to use checksums
c0d27c432c5881b9a74d0089f404426ed586f1d54cf0400f0830f90e87526d94
BLAKE2b-256 checksum
How to use checksums
70519b2c42c65fcf129b7bff68de054fa9b9ae7db55a85e59eabbf8ac7e14036
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/7.0.0 CPython/3.15.0

Release files / serversmtp-0.4.0-py3-none-any.whl

Download URL serversmtp-0.4.0-py3-none-any.whl
Size 5.1 kB
Tags Python 3
SHA-256 checksum
How to use checksums
f3e6c605382ead9db0d0472378d6272b1b0231f81d1f04ce78239adbdac4897c
BLAKE2b-256 checksum
How to use checksums
9db03a346766b62b4dd98ac561c1f65b6b7c682323b6991ecacf19df3f8e3803
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/7.0.0 CPython/3.15.0

Security for serversmtp 0.4.0

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

No provenance found

None of the files in this release were uploaded with provenance metadata.

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Release history Release notifications | RSS feed

This release

0.4.0 This release

2 release files No provenance

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page