Skip to main content

Python client library for Postmark API

Project description

Postmarker

Build Status Coverage Status Documentation Status Latest PyPI version

Python client library for Postmark API.

This library is in active development now. Contributions are very welcome!

Installation

Postmarker can be obtained with pip:

$ pip install postmarker

Example usage

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.6, 2.7, 3.2, 3.3, 3.4, 3.5, 3.6, PyPy, PyPy3 and Jython.

Thanks

Many thanks to Shmele and lobziik for their reviews and advices :)

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distributions

No source distribution files available for this release.See tutorial on generating distribution archives.

Built Distribution

postmarker-0.11.2-py2.py3-none-any.whl (24.9 kB view details)

Uploaded Python 2 Python 3

File details

Details for the file postmarker-0.11.2-py2.py3-none-any.whl.

File metadata

File hashes

Hashes for postmarker-0.11.2-py2.py3-none-any.whl
Algorithm Hash digest
SHA256 a422becb718d562ac0959e3169d0fa5296a3a1b8248ffa6cb99b1969f17ae580
MD5 f54a362c99221e0d5e9cd7c1dd5bdf4e
BLAKE2b-256 dd5bb2dcb1cd6e3e745f2ebc4c8a7b6e73d5338b0fcdf981a858f4af65c78a72

See more details on using hashes here.

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page