Skip to main content

Python client library for Postmark API

Project description

Postmarker

Build Coverage Version Python versions Documentation Status Gitter License

Python client library for Postmark API.

Gitter: https://gitter.im/Stranger6667/postmarker

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 CPython 3.6 - 3.10 and PyPy 3.7 & 3.8.

Thanks

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

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-1.0.tar.gz (21.6 kB view details)

Uploaded Source

Built Distribution

postmarker-1.0-py3-none-any.whl (24.1 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: postmarker-1.0.tar.gz
  • Upload date:
  • Size: 21.6 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.7.1 importlib_metadata/4.10.0 pkginfo/1.8.2 requests/2.27.1 requests-toolbelt/0.9.1 tqdm/4.62.3 CPython/3.9.9

File hashes

Hashes for postmarker-1.0.tar.gz
Algorithm Hash digest
SHA256 e735303fdf8ede667a1c6e64a95a96e97f0dabbeca726d0ae1f066bdd799fe34
MD5 eb241bdaebb62a203c664d0479a472e5
BLAKE2b-256 5179a527c6e91bc1c6980bc779b83249f59bf1cba8b259147c799934297cc7a8

See more details on using hashes here.

File details

Details for the file postmarker-1.0-py3-none-any.whl.

File metadata

  • Download URL: postmarker-1.0-py3-none-any.whl
  • Upload date:
  • Size: 24.1 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.7.1 importlib_metadata/4.10.0 pkginfo/1.8.2 requests/2.27.1 requests-toolbelt/0.9.1 tqdm/4.62.3 CPython/3.9.9

File hashes

Hashes for postmarker-1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 0fa49f236c7193650896cbf31bbfac34043e352574c6c7e3e2ad2b954704f064
MD5 c1806e0477246652cc873f6d9ab2fcb5
BLAKE2b-256 a14b045369491569fda223d2e0bc821534de14278dd4facdb386405ea17b9d80

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