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.

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


Download files

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

Source Distribution

postmarker-0.13.1.tar.gz (17.6 kB view details)

Uploaded Source

Built Distribution

postmarker-0.13.1-py2.py3-none-any.whl (24.5 kB view details)

Uploaded Python 2 Python 3

File details

Details for the file postmarker-0.13.1.tar.gz.

File metadata

  • Download URL: postmarker-0.13.1.tar.gz
  • Upload date:
  • Size: 17.6 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/2.0.0 pkginfo/1.5.0.1 requests/2.22.0 setuptools/41.2.0 requests-toolbelt/0.9.1 tqdm/4.36.1 CPython/3.7.4

File hashes

Hashes for postmarker-0.13.1.tar.gz
Algorithm Hash digest
SHA256 c092acd4eca546a7aef09f37a4c369d015ba327ffa462b2d42007e5d00ab7eff
MD5 9bd09f3793d7110a36e9c31e17ec1d1b
BLAKE2b-256 82680cd7f17779109dee598d0c96430a41544dbb77e460ba7db553b2af639a46

See more details on using hashes here.

File details

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

File metadata

  • Download URL: postmarker-0.13.1-py2.py3-none-any.whl
  • Upload date:
  • Size: 24.5 kB
  • Tags: Python 2, Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/2.0.0 pkginfo/1.5.0.1 requests/2.22.0 setuptools/41.2.0 requests-toolbelt/0.9.1 tqdm/4.36.1 CPython/3.7.4

File hashes

Hashes for postmarker-0.13.1-py2.py3-none-any.whl
Algorithm Hash digest
SHA256 0623406bfd529c90caa25265c64a3c6d7d0df3c5a6477d7a787dc95b43054664
MD5 1fa52333892a6d076e120be02730c93f
BLAKE2b-256 4b7e52834f863a6f4afc1303226b078a4dbcb3601985ad4f215ee823ecf5436e

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