Skip to content

Send transactional and marketing emails and get them to the inbox on time, every time. Postmark is a fast and reliable email delivery service for developers. Postmark's Python SDK generated by Konfig (https://konfigthis.com/).

License

Notifications You must be signed in to change notification settings

konfig-sdks/postmark-python-sdk

Repository files navigation

Visit Postmark

Postmark

Postmark makes sending and receiving email incredibly easy.

Table of Contents

Requirements

Python >=3.7

Installation

Getting Started

from pprint import pprint
from postmark_python_sdk import Postmark, ApiException

postmark = Postmark(
    server_token="YOUR_API_KEY",
)

try:
    # Activate a bounce
    activate_bounce_response = postmark.bounces_api.activate_bounce(
        bounceid=1,
    )
except ApiException as e:
    print("Exception when calling BouncesAPIApi.activate_bounce: %s\n" % e)
    pprint(e.body)
    if e.status == 422:
        pprint(e.body["error_code"])
        pprint(e.body["message"])
    pprint(e.headers)
    pprint(e.status)
    pprint(e.reason)
    pprint(e.round_trip_time)

Async

async support is available by prepending a to any method.

import asyncio
from pprint import pprint
from postmark_python_sdk import Postmark, ApiException

postmark = Postmark(
    server_token="YOUR_API_KEY",
)


async def main():
    try:
        # Activate a bounce
        activate_bounce_response = await postmark.bounces_api.aactivate_bounce(
            bounceid=1,
        )
    except ApiException as e:
        print("Exception when calling BouncesAPIApi.activate_bounce: %s\n" % e)
        pprint(e.body)
        if e.status == 422:
            pprint(e.body["error_code"])
            pprint(e.body["message"])
        pprint(e.headers)
        pprint(e.status)
        pprint(e.reason)
        pprint(e.round_trip_time)


asyncio.run(main())

Raw HTTP Response

To access raw HTTP response values, use the .raw namespace.

from pprint import pprint
from postmark_python_sdk import Postmark, ApiException

postmark = Postmark(
    server_token="YOUR_API_KEY",
)

try:
    # Activate a bounce
    activate_bounce_response = postmark.bounces_api.raw.activate_bounce(
        bounceid=1,
    )
    pprint(activate_bounce_response.headers)
    pprint(activate_bounce_response.status)
    pprint(activate_bounce_response.round_trip_time)
except ApiException as e:
    print("Exception when calling BouncesAPIApi.activate_bounce: %s\n" % e)
    pprint(e.body)
    if e.status == 422:
        pprint(e.body["error_code"])
        pprint(e.body["message"])
    pprint(e.headers)
    pprint(e.status)
    pprint(e.reason)
    pprint(e.round_trip_time)

Reference

postmark.bounces_api.activate_bounce

Activate a bounce

🛠️ Usage

activate_bounce_response = postmark.bounces_api.activate_bounce(
    bounceid=1,
)

⚙️ Parameters

bounceid: int

The ID of the Bounce to activate.

🌐 Endpoint

/bounces/{bounceid}/activate put

🔙 Back to Table of Contents


postmark.bounces_api.get_bounce

Get a single bounce

🛠️ Usage

get_bounce_response = postmark.bounces_api.get_bounce(
    bounceid=1,
)

⚙️ Parameters

bounceid: int

The ID of the bounce to retrieve.

🌐 Endpoint

/bounces/{bounceid} get

🔙 Back to Table of Contents


postmark.bounces_api.get_delivery_stats

Get delivery stats

🛠️ Usage

get_delivery_stats_response = postmark.bounces_api.get_delivery_stats()

🔄 Return

DeliveryStatsResponse

🌐 Endpoint

/deliverystats get

🔙 Back to Table of Contents


postmark.bounces_api.get_dump

Get bounce dump

🛠️ Usage

get_dump_response = postmark.bounces_api.get_dump(
    bounceid=1,
)

⚙️ Parameters

bounceid: int

The ID for the bounce dump to retrieve.

🌐 Endpoint

/bounces/{bounceid}/dump get

🔙 Back to Table of Contents


postmark.bounces_api.list_bounces

Get bounces

🛠️ Usage

list_bounces_response = postmark.bounces_api.list_bounces(
    count=1,
    offset=1,
    type="HardBounce",
    inactive=True,
    email_filter="string_example",
    message_id="string_example",
    tag="string_example",
    todate="1970-01-01",
    fromdate="1970-01-01",
)

⚙️ Parameters

count: int

Number of bounces to return per request. Max 500.

offset: int

Number of bounces to skip.

type: str

Filter by type of bounce

inactive: bool

Filter by emails that were deactivated by Postmark due to the bounce. Set to true or false. If this isn't specified it will return both active and inactive.

email_filter: str

Filter by email address

message_id: str

Filter by messageID

tag: str

Filter by tag

todate: date

Filter messages up to the date specified. e.g. 2014-02-01

fromdate: date

Filter messages starting from the date specified. e.g. 2014-02-01

🔄 Return

BounceSearchResponse

🌐 Endpoint

/bounces get

🔙 Back to Table of Contents


postmark.inbound_rules_api.create_trigger

Create an inbound rule trigger

🛠️ Usage

create_trigger_response = postmark.inbound_rules_api.create_trigger(
    body=None,
    rule="string_example",
)

⚙️ Parameters

rule: str

⚙️ Request Body

CreateInboundRuleRequest

🌐 Endpoint

/triggers/inboundrules post

🔙 Back to Table of Contents


postmark.inbound_rules_api.delete_single_trigger

Delete a single trigger

🛠️ Usage

delete_single_trigger_response = postmark.inbound_rules_api.delete_single_trigger(
    triggerid=1,
)

⚙️ Parameters

triggerid: int

The ID of the Inbound Rule that should be deleted.

🔄 Return

StandardPostmarkResponse

🌐 Endpoint

/triggers/inboundrules/{triggerid} delete

🔙 Back to Table of Contents


postmark.inbound_rules_api.list_triggers

List inbound rule triggers

🛠️ Usage

list_triggers_response = postmark.inbound_rules_api.list_triggers(
    count=1,
    offset=1,
)

⚙️ Parameters

count: int

Number of records to return per request.

offset: int

Number of records to skip.

🌐 Endpoint

/triggers/inboundrules get

🔙 Back to Table of Contents


postmark.messages_api.get_all_clicks

Clicks for a all messages

🛠️ Usage

get_all_clicks_response = postmark.messages_api.get_all_clicks(
    count=1,
    offset=1,
    recipient="string_example",
    tag="string_example",
    client_name="string_example",
    client_company="string_example",
    client_family="string_example",
    os_name="string_example",
    os_family="string_example",
    os_company="string_example",
    platform="string_example",
    country="string_example",
    region="string_example",
    city="string_example",
)

⚙️ Parameters

count: int

Number of message clicks to return per request. Max 500.

offset: int

Number of messages to skip

recipient: str

Filter by To, Cc, Bcc

tag: str

Filter by tag

client_name: str

Filter by client name, i.e. Outlook, Gmail

client_company: str

Filter by company, i.e. Microsoft, Apple, Google

client_family: str

Filter by client family, i.e. OS X, Chrome

os_name: str

Filter by full OS name and specific version, i.e. OS X 10.9 Mavericks, Windows 7

os_family: str

Filter by kind of OS used without specific version, i.e. OS X, Windows

os_company: str

Filter by company which produced the OS, i.e. Apple Computer, Inc., Microsoft Corporation

platform: str

Filter by platform, i.e. webmail, desktop, mobile

country: str

Filter by country messages were opened in, i.e. Denmark, Russia

region: str

Filter by full name of region messages were opened in, i.e. Moscow, New York

city: str

Filter by full name of region messages were opened in, i.e. Moscow, New York

🌐 Endpoint

/messages/outbound/clicks get

🔙 Back to Table of Contents


postmark.messages_api.get_inbound_message_details

Inbound message details

🛠️ Usage

get_inbound_message_details_response = (
    postmark.messages_api.get_inbound_message_details(
        messageid="messageid_example",
    )
)

⚙️ Parameters

messageid: str

The ID of the message for which to details will be retrieved.

🌐 Endpoint

/messages/inbound/{messageid}/details get

🔙 Back to Table of Contents


postmark.messages_api.get_message_clicks

Retrieve Message Clicks

🛠️ Usage

get_message_clicks_response = postmark.messages_api.get_message_clicks(
    messageid="messageid_example",
    count=1,
    offset=0,
)

⚙️ Parameters

messageid: str

The ID of the Outbound Message for which click statistics should be retrieved.

count: int

Number of message clicks to return per request. Max 500.

offset: int

Number of messages to skip.

🌐 Endpoint

/messages/outbound/clicks/{messageid} get

🔙 Back to Table of Contents


postmark.messages_api.get_message_dump

Outbound message dump

🛠️ Usage

get_message_dump_response = postmark.messages_api.get_message_dump(
    messageid="messageid_example",
)

⚙️ Parameters

messageid: str

The ID of the message for which to retrieve a dump.

🌐 Endpoint

/messages/outbound/{messageid}/dump get

🔙 Back to Table of Contents


postmark.messages_api.get_message_opens

Retrieve Message Opens

🛠️ Usage

get_message_opens_response = postmark.messages_api.get_message_opens(
    messageid="messageid_example",
    count=1,
    offset=0,
)

⚙️ Parameters

messageid: str

The ID of the Outbound Message for which open statistics should be retrieved.

count: int

Number of message opens to return per request. Max 500.

offset: int

Number of messages to skip.

🌐 Endpoint

/messages/outbound/opens/{messageid} get

🔙 Back to Table of Contents


postmark.messages_api.get_outbound_message_details

Outbound message details

🛠️ Usage

get_outbound_message_details_response = (
    postmark.messages_api.get_outbound_message_details(
        messageid="messageid_example",
    )
)

⚙️ Parameters

messageid: str

The ID of the message for which to retrieve details.

🌐 Endpoint

/messages/outbound/{messageid}/details get

🔙 Back to Table of Contents


postmark.messages_api.list_opens_for_outbound

Opens for all messages

🛠️ Usage

list_opens_for_outbound_response = postmark.messages_api.list_opens_for_outbound(
    count=1,
    offset=1,
    recipient="string_example",
    tag="string_example",
    client_name="string_example",
    client_company="string_example",
    client_family="string_example",
    os_name="string_example",
    os_family="string_example",
    os_company="string_example",
    platform="string_example",
    country="string_example",
    region="string_example",
    city="string_example",
)

⚙️ Parameters

count: int

Number of message opens to return per request. Max 500.

offset: int

Number of messages to skip

recipient: str

Filter by To, Cc, Bcc

tag: str

Filter by tag

client_name: str

Filter by client name, i.e. Outlook, Gmail

client_company: str

Filter by company, i.e. Microsoft, Apple, Google

client_family: str

Filter by client family, i.e. OS X, Chrome

os_name: str

Filter by full OS name and specific version, i.e. OS X 10.9 Mavericks, Windows 7

os_family: str

Filter by kind of OS used without specific version, i.e. OS X, Windows

os_company: str

Filter by company which produced the OS, i.e. Apple Computer, Inc., Microsoft Corporation

platform: str

Filter by platform, i.e. webmail, desktop, mobile

country: str

Filter by country messages were opened in, i.e. Denmark, Russia

region: str

Filter by full name of region messages were opened in, i.e. Moscow, New York

city: str

Filter by full name of region messages were opened in, i.e. Moscow, New York

🌐 Endpoint

/messages/outbound/opens get

🔙 Back to Table of Contents


postmark.messages_api.retry_inbound_message

Retry a failed inbound message for processing

🛠️ Usage

retry_inbound_message_response = postmark.messages_api.retry_inbound_message(
    messageid="messageid_example",
)

⚙️ Parameters

messageid: str

The ID of the inbound message on which we should retry processing.

🔄 Return

StandardPostmarkResponse

🌐 Endpoint

/messages/inbound/{messageid}/retry put

🔙 Back to Table of Contents


postmark.messages_api.search_inbound_messages

Inbound message search

🛠️ Usage

search_inbound_messages_response = postmark.messages_api.search_inbound_messages(
    count=1,
    offset=1,
    recipient="string_example",
    fromemail="string_example",
    subject="string_example",
    mailboxhash="string_example",
    tag="string_example",
    status="blocked",
    todate="1970-01-01",
    fromdate="1970-01-01",
)

⚙️ Parameters

count: int

Number of messages to return per request. Max 500.

offset: int

Number of messages to skip

recipient: str

Filter by the user who was receiving the email

fromemail: str

Filter by the sender email address

subject: str

Filter by email subject

mailboxhash: str

Filter by mailboxhash

tag: str

Filter by tag

status: str

Filter by status (blocked, processed, queued, failed, scheduled)

todate: date

Filter messages up to the date specified. e.g. 2014-02-01

fromdate: date

Filter messages starting from the date specified. e.g. 2014-02-01

🔄 Return

InboundSearchResponse

🌐 Endpoint

/messages/inbound get

🔙 Back to Table of Contents


postmark.messages_api.search_outbound_messages

Outbound message search

🛠️ Usage

search_outbound_messages_response = postmark.messages_api.search_outbound_messages(
    count=1,
    offset=1,
    recipient="string_example",
    fromemail="string_example",
    tag="string_example",
    status="queued",
    todate="1970-01-01",
    fromdate="1970-01-01",
)

⚙️ Parameters

count: int

Number of messages to return per request. Max 500.

offset: int

Number of messages to skip

recipient: str

Filter by the user who was receiving the email

fromemail: str

Filter by the sender email address

tag: str

Filter by tag

status: str

Filter by status (queued or sent)

todate: date

Filter messages up to the date specified. e.g. 2014-02-01

fromdate: date

Filter messages starting from the date specified. e.g. 2014-02-01

🔄 Return

OutboundSearchResponse

🌐 Endpoint

/messages/outbound get

🔙 Back to Table of Contents


postmark.messages_api.update_bypass_rules_for_inbound_message

Bypass rules for a blocked inbound message

🛠️ Usage

update_bypass_rules_for_inbound_message_response = (
    postmark.messages_api.update_bypass_rules_for_inbound_message(
        messageid="messageid_example",
    )
)

⚙️ Parameters

messageid: str

The ID of the message which should bypass inbound rules.

🔄 Return

StandardPostmarkResponse

🌐 Endpoint

/messages/inbound/{messageid}/bypass put

🔙 Back to Table of Contents


postmark.sending_api.send_batch_emails

Send a batch of emails

🛠️ Usage

send_batch_emails_response = postmark.sending_api.send_batch_emails(
    body=[None],
)

⚙️ Request Body

SendEmailBatchRequest

🔄 Return

SendEmailBatchResponse

🌐 Endpoint

/email/batch post

🔙 Back to Table of Contents


postmark.sending_api.send_batch_with_templates

Send a batch of email using templates.

🛠️ Usage

send_batch_with_templates_response = postmark.sending_api.send_batch_with_templates(
    body=None,
    messages=[None],
)

⚙️ Parameters

messages: List[EmailWithTemplateRequest]

⚙️ Request Body

SendEmailTemplatedBatchRequest

🔄 Return

SendEmailBatchResponse

🌐 Endpoint

/email/batchWithTemplates post

🔙 Back to Table of Contents


postmark.sending_api.send_email_template

Send an email using a Template

🛠️ Usage

send_email_template_response = postmark.sending_api.send_email_template(
    body=None,
    _from="string_example",
    template_alias="string_example",
    template_id=1,
    template_model={},
    to="string_example",
    attachments=[None],
    bcc="string_example",
    cc="string_example",
    headers=[None],
    inline_css=True,
    reply_to="string_example",
    tag="string_example",
    track_links="None",
    track_opens=True,
)

⚙️ Parameters

_from: str
template_alias: str

Required if 'TemplateId' is not specified.

template_id: int

Required if 'TemplateAlias' is not specified.

template_model: Dict[str, Union[bool, date, datetime, dict, float, int, list, str, None]]
to: str
bcc: str
cc: str
inline_css: bool
reply_to: str
tag: str
track_links: str

Replace links in content to enable \"click tracking\" stats. Default is 'null', which uses the server's LinkTracking setting'.

track_opens: bool

Activate open tracking for this email.

⚙️ Request Body

EmailWithTemplateRequest

🔄 Return

SendEmailResponse

🌐 Endpoint

/email/withTemplate post

🔙 Back to Table of Contents


postmark.sending_api.send_single_email

Send a single email

🛠️ Usage

send_single_email_response = postmark.sending_api.send_single_email(
    body=None,
    attachments=[None],
    bcc="string_example",
    cc="string_example",
    _from="string_example",
    headers=[None],
    html_body="string_example",
    reply_to="string_example",
    subject="string_example",
    tag="string_example",
    text_body="string_example",
    to="string_example",
    track_links="None",
    track_opens=True,
)

⚙️ Parameters

bcc: str

Bcc recipient email address. Multiple addresses are comma seperated. Max 50.

cc: str

Recipient email address. Multiple addresses are comma seperated. Max 50.

_from: str

The sender email address. Must have a registered and confirmed Sender Signature.

html_body: str

If no TextBody specified HTML email message

reply_to: str

Reply To override email address. Defaults to the Reply To set in the sender signature.

subject: str

Email Subject

tag: str

Email tag that allows you to categorize outgoing emails and get detailed statistics.

text_body: str

If no HtmlBody specified Plain text email message

to: str

Recipient email address. Multiple addresses are comma seperated. Max 50.

track_links: str

Replace links in content to enable \"click tracking\" stats. Default is 'null', which uses the server's LinkTracking setting'.

track_opens: bool

Activate open tracking for this email.

⚙️ Request Body

SendEmailRequest

🔄 Return

SendEmailResponse

🌐 Endpoint

/email post

🔙 Back to Table of Contents


postmark.server_configuration_api.get_configuration

Get Server Configuration

🛠️ Usage

get_configuration_response = postmark.server_configuration_api.get_configuration()

🌐 Endpoint

/server get

🔙 Back to Table of Contents


postmark.server_configuration_api.update_configuration

Edit Server Configuration

🛠️ Usage

update_configuration_response = postmark.server_configuration_api.update_configuration(
    body=None,
    bounce_hook_url="string_example",
    click_hook_url="string_example",
    color="purple",
    delivery_hook_url="string_example",
    inbound_domain="string_example",
    inbound_hook_url="string_example",
    inbound_spam_threshold=1,
    name="string_example",
    open_hook_url="string_example",
    post_first_open_only=True,
    raw_email_enabled=True,
    smtp_api_activated=True,
    track_links="None",
    track_opens=True,
)

⚙️ Parameters

bounce_hook_url: str
click_hook_url: str

Webhook url allowing real-time notification when tracked links are clicked.

color: str
delivery_hook_url: str
inbound_domain: str
inbound_hook_url: str
inbound_spam_threshold: int
name: str
open_hook_url: str
post_first_open_only: bool
raw_email_enabled: bool
smtp_api_activated: bool
track_links: str
track_opens: bool

⚙️ Request Body

EditServerConfigurationRequest The settings that should be modified for the current server.

🌐 Endpoint

/server put

🔙 Back to Table of Contents


postmark.stats_api.get_bounce_counts

Get bounce counts

🛠️ Usage

get_bounce_counts_response = postmark.stats_api.get_bounce_counts(
    tag="string_example",
    fromdate="1970-01-01",
    todate="1970-01-01",
)

⚙️ Parameters

tag: str

Filter by tag

fromdate: date

Filter stats starting from the date specified. e.g. 2014-01-01

todate: date

Filter stats up to the date specified. e.g. 2014-02-01

🌐 Endpoint

/stats/outbound/bounces get

🔙 Back to Table of Contents


postmark.stats_api.get_browser_platform_usage

Get browser plaform usage

🛠️ Usage

get_browser_platform_usage_response = postmark.stats_api.get_browser_platform_usage(
    tag="string_example",
    fromdate="1970-01-01",
    todate="1970-01-01",
)

⚙️ Parameters

tag: str

Filter by tag

fromdate: date

Filter stats starting from the date specified. e.g. 2014-01-01

todate: date

Filter stats up to the date specified. e.g. 2014-02-01

🌐 Endpoint

/stats/outbound/clicks/platforms get

🔙 Back to Table of Contents


postmark.stats_api.get_email_client_usage

Get email client usage

🛠️ Usage

get_email_client_usage_response = postmark.stats_api.get_email_client_usage(
    tag="string_example",
    fromdate="1970-01-01",
    todate="1970-01-01",
)

⚙️ Parameters

tag: str

Filter by tag

fromdate: date

Filter stats starting from the date specified. e.g. 2014-01-01

todate: date

Filter stats up to the date specified. e.g. 2014-02-01

🌐 Endpoint

/stats/outbound/opens/emailclients get

🔙 Back to Table of Contents


postmark.stats_api.get_email_open_counts

Get email open counts

🛠️ Usage

get_email_open_counts_response = postmark.stats_api.get_email_open_counts(
    tag="string_example",
    fromdate="1970-01-01",
    todate="1970-01-01",
)

⚙️ Parameters

tag: str

Filter by tag

fromdate: date

Filter stats starting from the date specified. e.g. 2014-01-01

todate: date

Filter stats up to the date specified. e.g. 2014-02-01

🌐 Endpoint

/stats/outbound/opens get

🔙 Back to Table of Contents


postmark.stats_api.get_email_platform_usage

Get email platform usage

🛠️ Usage

get_email_platform_usage_response = postmark.stats_api.get_email_platform_usage(
    tag="string_example",
    fromdate="1970-01-01",
    todate="1970-01-01",
)

⚙️ Parameters

tag: str

Filter by tag

fromdate: date

Filter stats starting from the date specified. e.g. 2014-01-01

todate: date

Filter stats up to the date specified. e.g. 2014-02-01

🌐 Endpoint

/stats/outbound/opens/platforms get

🔙 Back to Table of Contents


postmark.stats_api.get_outbound_click_counts

Get click counts

🛠️ Usage

get_outbound_click_counts_response = postmark.stats_api.get_outbound_click_counts(
    tag="string_example",
    fromdate="1970-01-01",
    todate="1970-01-01",
)

⚙️ Parameters

tag: str

Filter by tag

fromdate: date

Filter stats starting from the date specified. e.g. 2014-01-01

todate: date

Filter stats up to the date specified. e.g. 2014-02-01

🌐 Endpoint

/stats/outbound/clicks get

🔙 Back to Table of Contents


postmark.stats_api.get_outbound_clicks_browser_families

Get browser usage by family

🛠️ Usage

get_outbound_clicks_browser_families_response = (
    postmark.stats_api.get_outbound_clicks_browser_families(
        tag="string_example",
        fromdate="1970-01-01",
        todate="1970-01-01",
    )
)

⚙️ Parameters

tag: str

Filter by tag

fromdate: date

Filter stats starting from the date specified. e.g. 2014-01-01

todate: date

Filter stats up to the date specified. e.g. 2014-02-01

🌐 Endpoint

/stats/outbound/clicks/browserfamilies get

🔙 Back to Table of Contents


postmark.stats_api.get_outbound_clicks_location

Get clicks by body location

🛠️ Usage

get_outbound_clicks_location_response = postmark.stats_api.get_outbound_clicks_location(
    tag="string_example",
    fromdate="1970-01-01",
    todate="1970-01-01",
)

⚙️ Parameters

tag: str

Filter by tag

fromdate: date

Filter stats starting from the date specified. e.g. 2014-01-01

todate: date

Filter stats up to the date specified. e.g. 2014-02-01

🌐 Endpoint

/stats/outbound/clicks/location get

🔙 Back to Table of Contents


postmark.stats_api.get_outbound_overview

Get outbound overview

🛠️ Usage

get_outbound_overview_response = postmark.stats_api.get_outbound_overview(
    tag="string_example",
    fromdate="1970-01-01",
    todate="1970-01-01",
)

⚙️ Parameters

tag: str

Filter by tag

fromdate: date

Filter stats starting from the date specified. e.g. 2014-01-01

todate: date

Filter stats up to the date specified. e.g. 2014-02-01

🔄 Return

OutboundOverviewStatsResponse

🌐 Endpoint

/stats/outbound get

🔙 Back to Table of Contents


postmark.stats_api.get_sent_counts

Get sent counts

🛠️ Usage

get_sent_counts_response = postmark.stats_api.get_sent_counts(
    tag="string_example",
    fromdate="1970-01-01",
    todate="1970-01-01",
)

⚙️ Parameters

tag: str

Filter by tag

fromdate: date

Filter stats starting from the date specified. e.g. 2014-01-01

todate: date

Filter stats up to the date specified. e.g. 2014-02-01

🔄 Return

SentCountsResponse

🌐 Endpoint

/stats/outbound/sends get

🔙 Back to Table of Contents


postmark.stats_api.get_spam_complaints

Get spam complaints

🛠️ Usage

get_spam_complaints_response = postmark.stats_api.get_spam_complaints(
    tag="string_example",
    fromdate="1970-01-01",
    todate="1970-01-01",
)

⚙️ Parameters

tag: str

Filter by tag

fromdate: date

Filter stats starting from the date specified. e.g. 2014-01-01

todate: date

Filter stats up to the date specified. e.g. 2014-02-01

🌐 Endpoint

/stats/outbound/spam get

🔙 Back to Table of Contents


postmark.stats_api.get_tracked_email_counts

Get tracked email counts

🛠️ Usage

get_tracked_email_counts_response = postmark.stats_api.get_tracked_email_counts(
    tag="string_example",
    fromdate="1970-01-01",
    todate="1970-01-01",
)

⚙️ Parameters

tag: str

Filter by tag

fromdate: date

Filter stats starting from the date specified. e.g. 2014-01-01

todate: date

Filter stats starting from the date specified. e.g. 2014-01-01

🌐 Endpoint

/stats/outbound/tracked get

🔙 Back to Table of Contents


postmark.templates_api.create_template

Create a Template

🛠️ Usage

create_template_response = postmark.templates_api.create_template(
    body=None,
    name="string_example",
    subject="string_example",
    alias="string_example",
    html_body="string_example",
    text_body="string_example",
)

⚙️ Parameters

name: str

The friendly display name for the template.

subject: str

The Subject template definition for this Template.

alias: str

The optional string identifier for referring to this Template (numbers, letters, and '.', '-', '_' characters, starts with a letter).

html_body: str

The HTML template definition for this Template.

text_body: str

The Text template definition for this Template.

⚙️ Request Body

CreateTemplateRequest

🌐 Endpoint

/templates post

🔙 Back to Table of Contents


postmark.templates_api.delete_template

Delete a Template

🛠️ Usage

delete_template_response = postmark.templates_api.delete_template(
    template_id_or_alias="templateIdOrAlias_example",
)

⚙️ Parameters

template_id_or_alias: str

The 'TemplateID' or 'Alias' value for the Template you wish to delete.

🌐 Endpoint

/templates/{templateIdOrAlias} delete

🔙 Back to Table of Contents


postmark.templates_api.get_template_by_id

Get a Template

🛠️ Usage

get_template_by_id_response = postmark.templates_api.get_template_by_id(
    template_id_or_alias="templateIdOrAlias_example",
)

⚙️ Parameters

template_id_or_alias: str

The 'TemplateID' or 'Alias' value for the Template you wish to retrieve.

🌐 Endpoint

/templates/{templateIdOrAlias} get

🔙 Back to Table of Contents


postmark.templates_api.list_templates

Get the Templates associated with this Server

🛠️ Usage

list_templates_response = postmark.templates_api.list_templates(
    count=3.14,
    offset=3.14,
)

⚙️ Parameters

count: Union[int, float]

The number of Templates to return

offset: Union[int, float]

The number of Templates to "skip" before returning results.

🌐 Endpoint

/templates get

🔙 Back to Table of Contents


postmark.templates_api.send_batch_with_templates

Send a batch of email using templates.

🛠️ Usage

send_batch_with_templates_response = postmark.templates_api.send_batch_with_templates(
    body=None,
    messages=[None],
)

⚙️ Parameters

messages: List[EmailWithTemplateRequest]

⚙️ Request Body

SendEmailTemplatedBatchRequest

🔄 Return

SendEmailBatchResponse

🌐 Endpoint

/email/batchWithTemplates post

🔙 Back to Table of Contents


postmark.templates_api.send_email_template

Send an email using a Template

🛠️ Usage

send_email_template_response = postmark.templates_api.send_email_template(
    body=None,
    _from="string_example",
    template_alias="string_example",
    template_id=1,
    template_model={},
    to="string_example",
    attachments=[None],
    bcc="string_example",
    cc="string_example",
    headers=[None],
    inline_css=True,
    reply_to="string_example",
    tag="string_example",
    track_links="None",
    track_opens=True,
)

⚙️ Parameters

_from: str
template_alias: str

Required if 'TemplateId' is not specified.

template_id: int

Required if 'TemplateAlias' is not specified.

template_model: Dict[str, Union[bool, date, datetime, dict, float, int, list, str, None]]
to: str
bcc: str
cc: str
inline_css: bool
reply_to: str
tag: str
track_links: str

Replace links in content to enable \"click tracking\" stats. Default is 'null', which uses the server's LinkTracking setting'.

track_opens: bool

Activate open tracking for this email.

⚙️ Request Body

EmailWithTemplateRequest

🔄 Return

SendEmailResponse

🌐 Endpoint

/email/withTemplate post

🔙 Back to Table of Contents


postmark.templates_api.update_template

Update a Template

🛠️ Usage

update_template_response = postmark.templates_api.update_template(
    body=None,
    template_id_or_alias="templateIdOrAlias_example",
    alias="string_example",
    html_body="string_example",
    name="string_example",
    subject="string_example",
    text_body="string_example",
)

⚙️ Parameters

template_id_or_alias: str

The 'TemplateID' or 'Alias' value for the Template you wish to update.

alias: str

The optional string identifier for referring to this Template (numbers, letters, and '.', '-', '_' characters, starts with a letter).

html_body: str

The HTML template definition for this Template.

name: str

The friendly display name for the template.

subject: str

The Subject template definition for this Template.

text_body: str

The Text template definition for this Template.

⚙️ Request Body

EditTemplateRequest

🌐 Endpoint

/templates/{templateIdOrAlias} put

🔙 Back to Table of Contents


postmark.templates_api.validate_template_content

Test Template Content

🛠️ Usage

validate_template_content_response = postmark.templates_api.validate_template_content(
    body=None,
    html_body="string_example",
    inline_css_for_html_test_render=True,
    subject="string_example",
    test_render_model={},
    text_body="string_example",
)

⚙️ Parameters

html_body: str

The html body content to validate. Must be specified if Subject or TextBody are not. See our template language documentation for more information on the syntax for this field.

inline_css_for_html_test_render: bool

When HtmlBody is specified, the test render will have style blocks inlined as style attributes on matching html elements. You may disable the css inlining behavior by passing false for this parameter.

subject: str

The subject content to validate. Must be specified if HtmlBody or TextBody are not. See our template language documentation for more information on the syntax for this field.

test_render_model: Dict[str, Union[bool, date, datetime, dict, float, int, list, str, None]]

The model to be used when rendering test content.

text_body: str

The text body content to validate. Must be specified if HtmlBody or Subject are not. See our template language documentation for more information on the syntax for this field.

⚙️ Request Body

TemplateValidationRequest

🌐 Endpoint

/templates/validate post

🔙 Back to Table of Contents


Author

This Python package is automatically generated by Konfig

About

Send transactional and marketing emails and get them to the inbox on time, every time. Postmark is a fast and reliable email delivery service for developers. Postmark's Python SDK generated by Konfig (https://konfigthis.com/).

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages