Python client library for Postmark API
Maintained. Last release 8 days ago, commits in 3 of the last 26 weeks. Weaker on commit activity and contributor spread.
pip install postmarkerPostmarker
Python client for the Postmark email API.
Postmarker covers Postmark's API beyond sending: templates, bounces, suppressions, message streams, stats, servers and domains. It also ships a Django email backend, Postmark webhook wrappers and a pytest fixture for your tests.
[!NOTE] Postmarker keeps Postmark's field names:
From,HtmlBody,TemplateModel,MessageStream. Copy any field from the Postmark API docs and pass it as is. There are no snake_case aliases.
Installation
uv pip install postmarker
To inline <style> CSS into HTML emails, install the css-inline extra and create the client with inline_css=True:
uv pip install 'postmarker[css-inline]'
Usage
from postmarker.core import PostmarkClient
postmark = PostmarkClient(server_token="POSTMARK_API_TEST")
postmark.emails.send(
From="sender@example.com",
To="receiver@example.com",
Subject="Postmark test",
HtmlBody="<strong>Hello</strong> dear Postmark user.",
)
# {"ErrorCode": 0, "Message": "Test job accepted", "MessageID": "...", ...}
With the POSTMARK_API_TEST token, Postmark validates the request without delivering it.
To send real emails, use the server token from your server's API Tokens tab in Postmark.
must be a confirmed sender signature or an address on a verified domain.