API Reference¶
Email¶
-
class
postmarker.models.emails.
EmailManager
(client)[source]¶ Sends emails via Postmark REST API.
-
Email
(From, To, Cc=None, Bcc=None, Subject=None, Tag=None, HtmlBody=None, TextBody=None, Metadata=None, ReplyTo=None, Headers=None, TrackOpens=None, TrackLinks='None', Attachments=None, MessageStream=None)[source]¶ Constructs
Email
instance.- Returns
-
EmailBatch
(*emails)[source]¶ Constructs
EmailBatch
instance.- Returns
-
EmailTemplate
(*, TemplateId=None, TemplateModel, From, To, TemplateAlias=None, Cc=None, Bcc=None, Subject=None, Tag=None, ReplyTo=None, Headers=None, TrackOpens=None, TrackLinks='None', Attachments=None, InlineCss=True, Metadata=None, MessageStream=None)[source]¶ Constructs
EmailTemplate
instance.- Returns
-
EmailTemplateBatch
(*emails)[source]¶ Constructs
EmailTemplateBatch
instance.- Returns
-
send
(message=None, From=None, To=None, Cc=None, Bcc=None, Subject=None, Tag=None, HtmlBody=None, TextBody=None, Metadata=None, ReplyTo=None, Headers=None, TrackOpens=None, TrackLinks='None', Attachments=None, MessageStream=None)[source]¶ Sends a single email.
- Parameters
message –
Email
oremail.mime.text.MIMEText
instance.From (str) – The sender email address.
To (str or list) – Recipient’s email address. Multiple recipients could be specified as a list or string with comma separated values.
Cc (str or list) – Cc recipient’s email address. Multiple Cc recipients could be specified as a list or string with comma separated values.
Bcc (str or list) – Bcc recipient’s email address. Multiple Bcc recipients could be specified as a list or string with comma separated values.
Subject (str) – Email subject.
Tag (str) – Email tag.
HtmlBody (str) – HTML email message.
TextBody (str) – Plain text email message.
ReplyTo (str) – Reply To override email address.
Headers (dict) – Dictionary of custom headers to include.
TrackOpens (bool) – Activate open tracking for this email.
TrackLinks (str) – Activate link tracking for links in the HTML or Text bodies of this email.
Attachments (list) – List of attachments.
- Returns
Information about sent email.
- Return type
dict
-
Bounce¶
-
class
postmarker.models.bounces.
BounceManager
(client)[source]¶ Encapsulates logic about bounces.
-
Bounce
(json)[source]¶ Constructs new Bounce instance from JSON-encoded string. Intended to use for bounce webhook processing.
- Parameters
json – str
- Returns
-
activate
(id)[source]¶ Activates a bounce.
- Parameters
id (int) – Bounce ID.
- Returns
Activation result and bounce data.
- Return type
dict
-
all
(count=500, offset=0, type=None, inactive=None, emailFilter=None, tag=None, messageID=None, fromdate=None, todate=None)[source]¶ Returns many bounces.
- Parameters
count (int) – Number of bounces to return per request.
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.
emailFilter (str) – Filter by email address.
tag (str) – Filter by tag.
messageID (str) – Filter by messageID.
fromdate (date) – Filter messages starting from the date specified (inclusive).
todate (date) – Filter messages up to the date specified (inclusive).
- Returns
A list of
Bounce
instances.- Return type
list
-
property
deliverystats
¶ Returns number of inactive emails and list of bounce types with total counts.
- Return type
dict
-
get_dump
(id)[source]¶ Gets an SMTP data dump.
- Parameters
id (int) – Bounce ID.
- Returns
A dump of SMTP data if it is available.
- Return type
str or None
-
model
¶ alias of
postmarker.models.bounces.Bounce
A list of tags that have generated bounces for a given server.
- Return type
list
-
-
class
postmarker.models.bounces.
Bounce
(manager=None, **kwargs)[source]¶ Bounce model.
-
activate
()[source]¶ Activates the bounce instance and updates it with the latest data.
- Returns
Activation status.
- Return type
str
-
property
dump
¶ Gets SMTP data dump.
- Returns
Dump of SMTP data if it is available.
- Return type
str or None
-