Postmark
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
- gotcha postmarker is a community library, not an official Postmark SDK. Postmark has no official Python SDK. postmarker is the recommended community option per Postmark's developer docs, but it is not maintained by Postmark.
- gotcha postmarker v1.0 has no releases to PyPI in 12+ months as of mid-2025. The project may be effectively abandoned. Python 3.11+ compatibility has not been verified in recent releases.
- gotcha Field names in postmarker follow Postmark's PascalCase API convention, not Python snake_case. Code passing lowercase fields (from_email, html_body) is silently ignored or raises AttributeError.
- gotcha PostmarkClient constructor kwarg is server_token=, not token=. An earlier version used token= — code from older tutorials passes token= and raises TypeError.
- gotcha Use 'POSTMARK_API_TEST' as the server_token to send emails to Postmark's blackhole test environment (test@blackhole.postmarkapp.com). These emails are never delivered. Switch to a real server token for production.
Install
-
pip install postmarker -
pip install django-anymail[postmark]
Imports
- PostmarkClient
from postmarker.core import PostmarkClient postmark = PostmarkClient(server_token='SERVER_TOKEN')
- Django backend
# settings.py EMAIL_BACKEND = 'postmarker.django.EmailBackend' POSTMARK = { 'TOKEN': 'SERVER_TOKEN', 'TEST_MODE': False, 'VERBOSITY': 0, }
Quickstart
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')