Python client library for Postmark API
Project description
Postmarker
Python client library for Postmark API.
Installation
Postmarker can be obtained with pip:
$ pip install postmarker
Usage example
NOTE:
The attributes of all classes are provided as is, without transformation to snake case. We don’t want to introduce new names for existing entities.
Send single email:
>>> from postmarker.core import PostmarkClient
>>> postmark = PostmarkClient(server_token='API_TOKEN')
>>> postmark.emails.send(
From='sender@example.com',
To='receiver@example.com',
Subject='Postmark test',
HtmlBody='<html><body><strong>Hello</strong> dear Postmark user.</body></html>'
)
Send batch:
>>> postmark.emails.send_batch(
{
'From': 'sender@example.com',
'To': 'receiver@example.com',
'Subject': 'Postmark test',
'HtmlBody': '<html><body><strong>Hello</strong> dear Postmark user.</body></html>',
},
{
'From': 'sender2@example.com',
'To': 'receiver2@example.com',
'Subject': 'Postmark test 2',
'HtmlBody': '<html><body><strong>Hello</strong> dear Postmark user.</body></html>',
}
)
Setup an email:
>>> email = postmark.emails.Email(
From='sender@example.com',
To='receiver@example.com',
Subject='Postmark test',
HtmlBody='<html><body><strong>Hello</strong> dear Postmark user.</body></html>'
)
>>> email['X-Accept-Language'] = 'en-us, en'
>>> email.attach('/home/user/readme.txt')
>>> email.attach_binary(content=b'content', filename='readme.txt')
>>> email.send()
There are a lot of features available. Check it out in our documentation! Here’s just a few of them:
Support for sending Python email instances.
Bounces, Domains, Messages, Templates, Sender signatures, Status, Stats & Server API.
Django email backend.
Tornado helper.
Spam check API.
Wrappers for Bounce, Inbound, Open and Delivery webhooks.
Documentation
You can view the documentation online at:
Or you can look at the docs/ directory in the repository.
Python support
Postmarker supports Python 2.7, 3.4, 3.5, 3.6, 3.7, PyPy, PyPy3 and Jython.
Thanks
Many thanks to Shmele and lobziik for their reviews and advices :)
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Hashes for postmarker-0.14.1-py2.py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 57fa7bec921d3a885a389017d9bbae3b1a1ac4ea2b505d63252c434debcaa6a9 |
|
MD5 | 37a6cc05a962e263e344dc81b66a8dd1 |
|
BLAKE2b-256 | b1311171eb43bca53dfd44fc6d3ff4143c1378cf9123b9dfc89d59af057c62f4 |