Postmark

1.0 · maintenance · verified Sun Mar 01

Python client for the Postmark transactional email API. No official Python SDK exists — postmarker is the primary community library (listed by Postmark on their developer docs). Maintained by Dmitry Dygalo. v1.0 released but project marked inactive on Snyk (no new PyPI releases in 12+ months as of mid-2025). Django email backend included.

Warnings

Install

Imports

Quickstart

Field names match Postmark API exactly (PascalCase, not snake_case). Use 'POSTMARK_API_TEST' as token to send to the test/blackhole sandbox.

import os
from postmarker.core import PostmarkClient

postmark = PostmarkClient(server_token=os.environ['POSTMARK_SERVER_TOKEN'])

# Send single email
response = postmark.emails.send(
    From='sender@example.com',
    To='recipient@example.com',
    Subject='Hello from Postmark',
    HtmlBody='<strong>Hello!</strong>'
)
print(response['MessageID'])

# Send batch
postmark.emails.send_batch(
    {
        'From': 'sender@example.com',
        'To': 'recipient1@example.com',
        'Subject': 'Batch 1',
        'TextBody': 'Hello 1'
    },
    {
        'From': 'sender@example.com',
        'To': 'recipient2@example.com',
        'Subject': 'Batch 2',
        'TextBody': 'Hello 2'
    }
)

# Test token for sandbox
# postmark = PostmarkClient(server_token='POSTMARK_API_TEST')

view raw JSON →