Documentation
¶
Overview ¶
Package postmark encapsulates the Postmark API via Go
Index ¶
- Constants
- type APIError
- type ArchiveMessageStreamResponse
- type Attachment
- type BaseEvent
- type Bounce
- type BounceCounts
- type BounceDay
- type BounceEvent
- type BounceType
- type ClickEvent
- type Client
- func (client *Client) ActivateBounce(ctx context.Context, bounceID int64) (Bounce, string, error)
- func (client *Client) ArchiveMessageStream(ctx context.Context, id string) (ArchiveMessageStreamResponse, error)
- func (client *Client) BypassInboundMessage(ctx context.Context, messageID string) error
- func (client *Client) CreateDomain(ctx context.Context, request DomainCreateRequest) (DomainDetails, error)
- func (client *Client) CreateMessageStream(ctx context.Context, req CreateMessageStreamRequest) (MessageStream, error)
- func (client *Client) CreateSenderSignature(ctx context.Context, request SenderSignatureCreateRequest) (SenderSignatureDetails, error)
- func (client *Client) CreateServer(ctx context.Context, request ServerCreateRequest) (Server, error)
- func (client *Client) CreateSuppressions(ctx context.Context, streamID string, suppressions []Suppression) ([]SuppressionResponse, error)
- func (client *Client) CreateTemplate(ctx context.Context, template Template) (TemplateInfo, error)
- func (client *Client) CreateWebhook(ctx context.Context, webhook Webhook) (Webhook, error)
- func (client *Client) DeleteDomain(ctx context.Context, domainID int64) error
- func (client *Client) DeleteSenderSignature(ctx context.Context, signatureID int64) error
- func (client *Client) DeleteServer(ctx context.Context, serverID int64) error
- func (client *Client) DeleteSuppressions(ctx context.Context, streamID string, suppressions []Suppression) ([]SuppressionResponse, error)
- func (client *Client) DeleteTemplate(ctx context.Context, templateID string) error
- func (client *Client) DeleteWebhook(ctx context.Context, id int) error
- func (client *Client) EditCurrentServer(ctx context.Context, server Server) (Server, error)
- func (client *Client) EditDomain(ctx context.Context, domainID int64, request DomainEditRequest) (DomainDetails, error)
- func (client *Client) EditMessageStream(ctx context.Context, id string, req EditMessageStreamRequest) (MessageStream, error)
- func (client *Client) EditSenderSignature(ctx context.Context, signatureID int64, request SenderSignatureEditRequest) (SenderSignatureDetails, error)
- func (client *Client) EditServer(ctx context.Context, serverID int64, request ServerEditRequest) (Server, error)
- func (client *Client) EditTemplate(ctx context.Context, templateID string, template Template) (TemplateInfo, error)
- func (client *Client) EditWebhook(ctx context.Context, id int, webhook Webhook) (Webhook, error)
- func (client *Client) GetBounce(ctx context.Context, bounceID int64) (Bounce, error)
- func (client *Client) GetBounceCounts(ctx context.Context, options map[string]interface{}) (BounceCounts, error)
- func (client *Client) GetBounceDump(ctx context.Context, bounceID int64) (string, error)
- func (client *Client) GetBouncedTags(ctx context.Context) ([]string, error)
- func (client *Client) GetBounces(ctx context.Context, count int64, offset int64, options map[string]interface{}) ([]Bounce, int64, error)
- func (client *Client) GetCurrentServer(ctx context.Context) (Server, error)
- func (client *Client) GetDeliveryStats(ctx context.Context) (DeliveryStats, error)
- func (client *Client) GetDomain(ctx context.Context, domainID int64) (DomainDetails, error)
- func (client *Client) GetDomains(ctx context.Context, count, offset int) (DomainsList, error)
- func (client *Client) GetInboundMessage(ctx context.Context, messageID string) (InboundMessage, error)
- func (client *Client) GetInboundMessages(ctx context.Context, count int64, offset int64, options map[string]interface{}) ([]InboundMessage, int64, error)
- func (client *Client) GetMessageStream(ctx context.Context, id string) (MessageStream, error)
- func (client *Client) GetOpenCounts(ctx context.Context, options map[string]interface{}) (OpenCounts, error)
- func (client *Client) GetOutboundMessage(ctx context.Context, messageID string) (OutboundMessage, error)
- func (client *Client) GetOutboundMessageDump(ctx context.Context, messageID string) (string, error)
- func (client *Client) GetOutboundMessageOpens(ctx context.Context, messageID string, count int64, offset int64) ([]Open, int64, error)
- func (client *Client) GetOutboundMessages(ctx context.Context, count int64, offset int64, options map[string]interface{}) ([]OutboundMessage, int64, error)
- func (client *Client) GetOutboundMessagesOpens(ctx context.Context, count int64, offset int64, options map[string]interface{}) ([]Open, int64, error)
- func (client *Client) GetOutboundStats(ctx context.Context, options map[string]interface{}) (OutboundStats, error)
- func (client *Client) GetPlatformCounts(ctx context.Context, options map[string]interface{}) (PlatformCounts, error)
- func (client *Client) GetSenderSignature(ctx context.Context, signatureID int64) (SenderSignatureDetails, error)
- func (client *Client) GetSenderSignatures(ctx context.Context, count, offset int64) (SenderSignaturesList, error)
- func (client *Client) GetSentCounts(ctx context.Context, options map[string]interface{}) (SendCounts, error)
- func (client *Client) GetServer(ctx context.Context, serverID int64) (Server, error)
- func (client *Client) GetServers(ctx context.Context, count, offset int64, name string) (ServersList, error)
- func (client *Client) GetSpamCounts(ctx context.Context, options map[string]interface{}) (SpamCounts, error)
- func (client *Client) GetSuppressions(ctx context.Context, streamID string, options map[string]interface{}) ([]Suppression, error)
- func (client *Client) GetTemplate(ctx context.Context, templateID string) (Template, error)
- func (client *Client) GetTemplates(ctx context.Context, count int64, offset int64) ([]TemplateInfo, int64, error)
- func (client *Client) GetTrackedCounts(ctx context.Context, options map[string]interface{}) (TrackedCounts, error)
- func (client *Client) GetWebhook(ctx context.Context, id int) (Webhook, error)
- func (client *Client) ListMessageStreams(ctx context.Context, messageStreamType string, includeArchived bool) ([]MessageStream, error)
- func (client *Client) ListWebhooks(ctx context.Context, messageStream string) ([]Webhook, error)
- func (client *Client) ResendSenderSignatureConfirmation(ctx context.Context, signatureID int64) error
- func (client *Client) RetryInboundMessage(ctx context.Context, messageID string) error
- func (client *Client) RotateDKIM(ctx context.Context, domainID int64) (DomainDetails, error)
- func (client *Client) SendEmail(ctx context.Context, email Email) (EmailResponse, error)
- func (client *Client) SendEmailBatch(ctx context.Context, emails []Email) ([]EmailResponse, error)
- func (client *Client) SendTemplatedEmail(ctx context.Context, email TemplatedEmail) (EmailResponse, error)
- func (client *Client) SendTemplatedEmailBatch(ctx context.Context, emails []TemplatedEmail) ([]EmailResponse, error)
- func (client *Client) UnarchiveMessageStream(ctx context.Context, id string) (MessageStream, error)
- func (client *Client) ValidateTemplate(ctx context.Context, validateTemplateBody ValidateTemplateBody) (ValidateTemplateResponse, error)
- func (client *Client) VerifyDKIMStatus(ctx context.Context, domainID int64) (DomainDetails, error)
- func (client *Client) VerifyReturnPath(ctx context.Context, domainID int64) (DomainDetails, error)
- type ClientInfo
- type CreateMessageStreamRequest
- type DeliveryEvent
- type DeliveryStats
- type Domain
- type DomainCreateRequest
- type DomainDetails
- type DomainEditRequest
- type DomainsList
- type EditMessageStreamRequest
- type Email
- type EmailResponse
- type GeoInfo
- type Header
- type InboundMessage
- type MessageEvent
- type MessageStream
- type MessageStreamSubscriptionManagementConfiguration
- type MessageStreamType
- type MessageStreamUnsubscribeHandlingType
- type OSInfo
- type Open
- type OpenCounts
- type OpenEvent
- type OpenedDay
- type OriginType
- type OutboundMessage
- type OutboundStats
- type PlatformCounts
- type PlatformDay
- type Recipient
- type SendCounts
- type SendDay
- type SenderSignature
- type SenderSignatureCreateRequest
- type SenderSignatureDetails
- type SenderSignatureEditRequest
- type SenderSignaturesList
- type Server
- type ServerCreateRequest
- type ServerEditRequest
- type ServersList
- type SpamComplaintEvent
- type SpamCounts
- type SpamDay
- type SubscriptionChangeEvent
- type Suppression
- type SuppressionReasonType
- type SuppressionResponse
- type SuppressionUpdateStatus
- type Template
- type TemplateInfo
- type TemplatedEmail
- type TrackedCounts
- type TrackedDay
- type ValidateTemplateBody
- type ValidateTemplateResponse
- type Validation
- type ValidationError
- type Webhook
- type WebhookHTTPAuth
- type WebhookTrigger
- type WebhookTriggerEnabled
- type WebhookTriggerIncContent
- type WebhookTriggerOpen
Constants ¶
const ( // InboundMessageStreamType indicates a message stream is for inbound messages. InboundMessageStreamType MessageStreamType = "Inbound" // BroadcastMessageStreamType indicates a message stream is for broadcast messages. BroadcastMessageStreamType MessageStreamType = "Broadcasts" // TransactionalMessageStreamType indicates a message stream is for transactional messages. TransactionalMessageStreamType MessageStreamType = "Transactional" // NoneUnsubscribeHandlingType indicates a message stream unsubscribe // handling will be performed by the user. NoneUnsubscribeHandlingType MessageStreamUnsubscribeHandlingType = "None" // PostmarkUnsubscribeHandlingType indicates a message stream unsubscribe // handling will be performed by postmark. PostmarkUnsubscribeHandlingType MessageStreamUnsubscribeHandlingType = "Postmark" // CustomUnsubscribeHandlingType indicates a message stream unsubscribe // handling is custom. CustomUnsubscribeHandlingType MessageStreamUnsubscribeHandlingType = "Custom" )
const ( // HardBounceReason means an email sent to the address returned a hard bounce. HardBounceReason SuppressionReasonType = "HardBounce" // SpamComplaintReason means the recipient marked an email as spam. SpamComplaintReason SuppressionReasonType = "SpamComplaint" // ManualSuppressionReason means the recipient followed an unsubscribe link. ManualSuppressionReason SuppressionReasonType = "ManualSuppression" // RecipientOrigin means the email was added to the suppression list // as a result of the recipient's own action, e.g. by following an unsubscribe link. RecipientOrigin OriginType = "Recipient" // CustomerOrigin means the email was added to the suppression list as // the result of action by the Postmark account holder (e.g. Postmark's // customer). CustomerOrigin OriginType = "Customer" // AdminOrigin means the email was added to the suppression list as // the result of action by Postmark staff. AdminOrigin OriginType = "Admin" // SuppressionUpdateStatusSuppressed means the server successfully suppressed the email address. SuppressionUpdateStatusSuppressed SuppressionUpdateStatus = "Suppressed" // SuppressionUpdateStatusDeleted means the server successfully deleted the suppression. SuppressionUpdateStatusDeleted SuppressionUpdateStatus = "Deleted" // SuppressionUpdateStatusFailed means the server failed to update the suppression. SuppressionUpdateStatusFailed SuppressionUpdateStatus = "Failed" )
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type APIError ¶
type APIError struct { // ErrorCode: see error codes here (https://postmarkapp.com/developer/api/overview#error-codes) ErrorCode int64 `json:"ErrorCode"` // Message contains error details Message string `json:"Message"` }
APIError represents errors returned by Postmark
type ArchiveMessageStreamResponse ¶ added in v1.6.0
type ArchiveMessageStreamResponse struct { // ID of message stream. ID string `json:"ID"` // Server ID of message stream. ServerID int `json:"ServerID"` // Expected purge date of message stream. Stream is deleted 45 days after // archiving date. Until this date, it can be restored. ExpectedPurgeDate string `json:"ExpectedPurgeDate"` }
ArchiveMessageStreamResponse is the response body for ArchiveMessageStream.
type Attachment ¶
type Attachment struct { // Name: attachment name Name string // Content: Base64 encoded attachment data Content string // ContentType: attachment MIME type ContentType string // ContentId: populate for inlining images with the images cid ContentID string `json:",omitempty"` }
Attachment is an optional encoded file to send along with an email
type BaseEvent ¶ added in v1.7.3
type BaseEvent struct { RecordType string `json:"RecordType"` MessageID string `json:"MessageID"` MessageStream string `json:"MessageStream"` Metadata map[string]interface{} `json:"Metadata,omitempty"` Tag string `json:"Tag,omitempty"` }
BaseEvent contains fields that are common across all webhook event types
type Bounce ¶
type Bounce struct { // ID: ID of bounce ID int64 // Type: Bounce type Type string // TypeCode: Bounce type code TypeCode int64 // Name: Bounce type name Name string // Tag: Tag name Tag string // MessageID: ID of message MessageID string // Description: Description of bounce Description string // Details: Details on the bounce Details string // Email: Email address that bounced Email string // BouncedAt: Timestamp of bounce BouncedAt time.Time // DumpAvailable: Specifies whether you can get a raw dump from this bounce. Postmark does not store bounce dumps older than 30 days. DumpAvailable bool // Inactive: Specifies if the bounce caused Postmark to deactivate this email. Inactive bool // CanActivate: Specifies whether you are able to reactivate this email. CanActivate bool // Subject: Email subject Subject string }
Bounce represents a specific delivery failure
type BounceCounts ¶
type BounceCounts struct { // Days - List of objects that each represent sent counts by date. Days []BounceDay // HardBounce - total number of hard bounces HardBounce int64 // SoftBounce - total number of soft bounces SoftBounce int64 // SMTPApiError - total number of SMTP errors SMTPApiError int64 // Transient - total number of transient bounces. Transient int64 }
BounceCounts - bounce stats for a period
type BounceDay ¶
type BounceDay struct { // Date - self-explanatory Date string // HardBounce - number of hard bounces HardBounce int64 // SoftBounce - number of soft bounces SoftBounce int64 // SMTPApiError - number of SMTP errors SMTPApiError int64 // Transient - number of transient bounces. Transient int64 }
BounceDay - bounce stats for a specific day
type BounceEvent ¶ added in v1.7.3
type BounceEvent struct { BaseEvent ID int `json:"ID"` Type string `json:"Type"` TypeCode int `json:"TypeCode"` Name string `json:"Name"` ServerID int `json:"ServerID"` Description string `json:"Description"` Details string `json:"Details,omitempty"` Email string `json:"Email"` From string `json:"From"` BouncedAt time.Time `json:"BouncedAt"` DumpAvailable bool `json:"DumpAvailable"` Inactive bool `json:"Inactive"` CanActivate bool `json:"CanActivate"` Subject string `json:"Subject"` Content string `json:"Content"` }
BounceEvent represents an email bounce webhook event
type BounceType ¶
type BounceType struct { // Type: bounce type identifier Type string // Name: full name of the bounce type Name string // Count: how many bounces have occurred Count int64 }
BounceType represents a type of bounce, and how many bounces have occurred http://developer.postmarkapp.com/developer-api-bounce.html#bounce-types
type ClickEvent ¶ added in v1.7.3
type ClickEvent struct { BaseEvent Recipient string `json:"Recipient"` ReceivedAt time.Time `json:"ReceivedAt"` Platform string `json:"Platform"` ClickLocation string `json:"ClickLocation"` OriginalLink string `json:"OriginalLink"` UserAgent string `json:"UserAgent"` OS OSInfo `json:"OS"` Client ClientInfo `json:"Client"` Geo GeoInfo `json:"Geo"` }
ClickEvent represents a link click webhook event
type Client ¶
type Client struct { // HTTPClient is &http.Client{} by default HTTPClient *http.Client // Server Token: Used for requests that require server level privileges. This token can be found on the Credentials tab under your Postmark server. ServerToken string // AccountToken: Used for requests that require account level privileges. This token is only accessible by the account owner, and can be found on the Account tab of your Postmark account. AccountToken string // BaseURL is the root API endpoint BaseURL string }
Client provides a connection to the Postmark API
func NewClient ¶
NewClient builds a new Client pointer using the provided tokens, a default HTTPClient, and a default API base URL Accepts `Server Token`, and `Account Token` as arguments http://developer.postmarkapp.com/developer-api-overview.html#authentication
func (*Client) ActivateBounce ¶
ActivateBounce reactivates a bounce for resending. Returns the bounce, a message, and any error that occurs TODO: clarify this with Postmark
func (*Client) ArchiveMessageStream ¶ added in v1.6.0
func (client *Client) ArchiveMessageStream(ctx context.Context, id string) (ArchiveMessageStreamResponse, error)
ArchiveMessageStream archives a message stream. Archived streams are deleted after 45 days, but they can be restored until that point.
func (*Client) BypassInboundMessage ¶
BypassInboundMessage - Bypass rules for a blocked inbound message
func (*Client) CreateDomain ¶ added in v1.7.0
func (client *Client) CreateDomain(ctx context.Context, request DomainCreateRequest) (DomainDetails, error)
CreateDomain creates a domain
func (*Client) CreateMessageStream ¶ added in v1.6.0
func (client *Client) CreateMessageStream(ctx context.Context, req CreateMessageStreamRequest) (MessageStream, error)
CreateMessageStream makes a new message stream. It will be created on the server of the token used by this Client.
func (*Client) CreateSenderSignature ¶ added in v1.7.0
func (client *Client) CreateSenderSignature(ctx context.Context, request SenderSignatureCreateRequest) (SenderSignatureDetails, error)
CreateSenderSignature creates a new sender signature and returns the full details of the new sender signature.
func (*Client) CreateServer ¶ added in v1.6.7
func (client *Client) CreateServer(ctx context.Context, request ServerCreateRequest) (Server, error)
CreateServer creates a server
func (*Client) CreateSuppressions ¶ added in v1.6.3
func (client *Client) CreateSuppressions( ctx context.Context, streamID string, suppressions []Suppression, ) ([]SuppressionResponse, error)
CreateSuppressions creates email addresses in the suppression list on the server.
func (*Client) CreateTemplate ¶
CreateTemplate saves a new template to the server
func (*Client) CreateWebhook ¶ added in v1.5.0
CreateWebhook makes a new Webhook. Do not specify the ID in the provided webhook. The returned webhook if successful will include the ID of the created webhook.
func (*Client) DeleteDomain ¶ added in v1.7.0
DeleteDomain deletes a specific domain via domainID
func (*Client) DeleteSenderSignature ¶ added in v1.7.0
DeleteSenderSignature removes a sender from the server.
func (*Client) DeleteServer ¶ added in v1.7.0
DeleteServer removes a server.
func (*Client) DeleteSuppressions ¶ added in v1.6.3
func (client *Client) DeleteSuppressions( ctx context.Context, streamID string, suppressions []Suppression, ) ([]SuppressionResponse, error)
DeleteSuppressions deletes email addresses from the suppression list on the server. SpamComplaint suppressions cannot be deleted.
func (*Client) DeleteTemplate ¶
DeleteTemplate removes a template (with templateID) from the server
func (*Client) DeleteWebhook ¶ added in v1.5.0
DeleteWebhook removes a webhook from the server.
func (*Client) EditCurrentServer ¶
EditCurrentServer updates details for the server associated with the currently in-use server API Key
func (*Client) EditDomain ¶ added in v1.7.0
func (client *Client) EditDomain(ctx context.Context, domainID int64, request DomainEditRequest) (DomainDetails, error)
EditDomain updates details for a specific domain with domainID
func (*Client) EditMessageStream ¶ added in v1.6.0
func (client *Client) EditMessageStream(ctx context.Context, id string, req EditMessageStreamRequest) (MessageStream, error)
EditMessageStream updates a message stream.
func (*Client) EditSenderSignature ¶ added in v1.7.0
func (client *Client) EditSenderSignature(ctx context.Context, signatureID int64, request SenderSignatureEditRequest) (SenderSignatureDetails, error)
EditSenderSignature updates an existing sender signature and returns the full details of the updated sender signature.
func (*Client) EditServer ¶
func (client *Client) EditServer(ctx context.Context, serverID int64, request ServerEditRequest) (Server, error)
EditServer updates details for a specific server with serverID
func (*Client) EditTemplate ¶
func (client *Client) EditTemplate(ctx context.Context, templateID string, template Template) (TemplateInfo, error)
EditTemplate updates details for a specific template with templateID
func (*Client) EditWebhook ¶ added in v1.5.0
EditWebhook alters an existing webhook. Do not specify the ID in the provided webhook. The returned webhook if successful will be the resulting state of after the edit.
func (*Client) GetBounceCounts ¶
func (client *Client) GetBounceCounts(ctx context.Context, options map[string]interface{}) (BounceCounts, error)
GetBounceCounts - Gets total counts of emails you’ve sent out that have been returned as bounced. Available options: http://developer.postmarkapp.com/developer-api-stats.html#bounce-counts
func (*Client) GetBounceDump ¶
GetBounceDump fetches an SMTP data dump for a single bounce
func (*Client) GetBouncedTags ¶
GetBouncedTags retrieves a list of tags that have generated bounced emails
func (*Client) GetBounces ¶
func (client *Client) GetBounces(ctx context.Context, count int64, offset int64, options map[string]interface{}) ([]Bounce, int64, error)
GetBounces returns bounces for the server It returns a Bounce slice, the total bounce count, and any error that occurred Available options: http://developer.postmarkapp.com/developer-api-bounce.html#bounces
func (*Client) GetCurrentServer ¶
GetCurrentServer gets details for the server associated with the currently in-use server API Key
func (*Client) GetDeliveryStats ¶
func (client *Client) GetDeliveryStats(ctx context.Context) (DeliveryStats, error)
GetDeliveryStats returns delivery stats for the server
func (*Client) GetDomains ¶ added in v1.7.0
GetDomains gets a list of domains, limited by count and paged by offset
func (*Client) GetInboundMessage ¶
func (client *Client) GetInboundMessage(ctx context.Context, messageID string) (InboundMessage, error)
GetInboundMessage fetches a specific inbound message via serverID
func (*Client) GetInboundMessages ¶
func (client *Client) GetInboundMessages(ctx context.Context, count int64, offset int64, options map[string]interface{}) ([]InboundMessage, int64, error)
GetInboundMessages fetches a list of inbound message on the server It returns a InboundMessage slice, the total message count, and any error that occurred http://developer.postmarkapp.com/developer-api-messages.html#inbound-message-search
func (*Client) GetMessageStream ¶ added in v1.6.0
GetMessageStream retrieves a specific message stream by the message stream's ID.
func (*Client) GetOpenCounts ¶
func (client *Client) GetOpenCounts(ctx context.Context, options map[string]interface{}) (OpenCounts, error)
GetOpenCounts - Gets total counts of recipients who opened your emails. This is only recorded when open tracking is enabled for that email. Available options: http://developer.postmarkapp.com/developer-api-stats.html#email-opens-count
func (*Client) GetOutboundMessage ¶
func (client *Client) GetOutboundMessage(ctx context.Context, messageID string) (OutboundMessage, error)
GetOutboundMessage fetches a specific outbound message via serverID
func (*Client) GetOutboundMessageDump ¶
GetOutboundMessageDump fetches the raw source of message. If no dump is available this will return an empty string.
func (*Client) GetOutboundMessageOpens ¶
func (client *Client) GetOutboundMessageOpens(ctx context.Context, messageID string, count int64, offset int64) ([]Open, int64, error)
GetOutboundMessageOpens fetches a list of opens for a specific message It returns an Open slice, the total opens count, and any error that occurred
func (*Client) GetOutboundMessages ¶
func (client *Client) GetOutboundMessages(ctx context.Context, count int64, offset int64, options map[string]interface{}) ([]OutboundMessage, int64, error)
GetOutboundMessages fetches a list of outbound message on the server It returns a OutboundMessage slice, the total message count, and any error that occurred Note: that a single open is bound to a single recipient, so if the same message was sent to two recipients and both of them opened it, that will be represented by two entries in this array. Available options: http://developer.postmarkapp.com/developer-api-messages.html#outbound-message-search
func (*Client) GetOutboundMessagesOpens ¶
func (client *Client) GetOutboundMessagesOpens(ctx context.Context, count int64, offset int64, options map[string]interface{}) ([]Open, int64, error)
GetOutboundMessagesOpens fetches a list of opens on the server It returns an Open slice, the total opens count, and any error that occurred To get opens for a specific message, use GetOutboundMessageOpens() Available options: http://developer.postmarkapp.com/developer-api-messages.html#message-opens
func (*Client) GetOutboundStats ¶
func (client *Client) GetOutboundStats(ctx context.Context, options map[string]interface{}) (OutboundStats, error)
GetOutboundStats - Gets a brief overview of statistics for all of your outbound email. Available options: http://developer.postmarkapp.com/developer-api-stats.html#overview
func (*Client) GetPlatformCounts ¶
func (client *Client) GetPlatformCounts(ctx context.Context, options map[string]interface{}) (PlatformCounts, error)
GetPlatformCounts gets the email platform usage
func (*Client) GetSenderSignature ¶ added in v1.7.0
func (client *Client) GetSenderSignature(ctx context.Context, signatureID int64) (SenderSignatureDetails, error)
GetSenderSignature gets all the details for a specific sender signature.
func (*Client) GetSenderSignatures ¶
func (client *Client) GetSenderSignatures(ctx context.Context, count, offset int64) (SenderSignaturesList, error)
GetSenderSignatures gets a list of sender signatures containing brief details associated with your account, limited by count and paged by offset
func (*Client) GetSentCounts ¶
func (client *Client) GetSentCounts(ctx context.Context, options map[string]interface{}) (SendCounts, error)
GetSentCounts - Gets a total count of emails you’ve sent out. Available options: http://developer.postmarkapp.com/developer-api-stats.html#sent-counts
func (*Client) GetServers ¶ added in v1.7.0
func (client *Client) GetServers(ctx context.Context, count, offset int64, name string) (ServersList, error)
GetServers fetches a list of servers on the account, limited by count and paged by offset Optionally filter by a specific server name. Note that this is a string search, so MyServer will match MyServer, MyServer Production, and MyServer Test.
func (*Client) GetSpamCounts ¶
func (client *Client) GetSpamCounts(ctx context.Context, options map[string]interface{}) (SpamCounts, error)
GetSpamCounts - Gets a total count of recipients who have marked your email as spam. Days that did not produce statistics won’t appear in the JSON response. Available options: http://developer.postmarkapp.com/developer-api-stats.html#spam-complaints
func (*Client) GetSuppressions ¶ added in v1.4.0
func (client *Client) GetSuppressions( ctx context.Context, streamID string, options map[string]interface{}, ) ([]Suppression, error)
GetSuppressions fetches email addresses in the list of suppression dump on the server It returns a Suppressions slice, and any error that occurred https://postmarkapp.com/developer/api/suppressions-api#suppression-dump
func (*Client) GetTemplate ¶
GetTemplate fetches a specific template via TemplateID
func (*Client) GetTemplates ¶
func (client *Client) GetTemplates(ctx context.Context, count int64, offset int64) ([]TemplateInfo, int64, error)
GetTemplates fetches a list of templates on the server It returns a TemplateInfo slice, the total template count, and any error that occurred Note: TemplateInfo only returns a subset of template attributes, use GetTemplate(id) to retrieve all template info.
func (*Client) GetTrackedCounts ¶
func (client *Client) GetTrackedCounts(ctx context.Context, options map[string]interface{}) (TrackedCounts, error)
GetTrackedCounts - Gets a total count of emails you’ve sent with open tracking enabled. Available options: http://developer.postmarkapp.com/developer-api-stats.html#email-tracked-count
func (*Client) GetWebhook ¶ added in v1.5.0
GetWebhook retrieves a specific webhook by the webhook's ID.
func (*Client) ListMessageStreams ¶ added in v1.6.0
func (client *Client) ListMessageStreams(ctx context.Context, messageStreamType string, includeArchived bool) ([]MessageStream, error)
ListMessageStreams returns all message streams for a server. messageStreamType must be one of "All", "Inbound", "Transactional", "Broadcasts" and defaults to "All".
func (*Client) ListWebhooks ¶ added in v1.5.0
ListWebhooks returns all webhooks for a message stream. If the message stream is empty it will return all webhooks for the server. A non-existent message stream will result in an error.
func (*Client) ResendSenderSignatureConfirmation ¶ added in v1.7.0
func (client *Client) ResendSenderSignatureConfirmation(ctx context.Context, signatureID int64) error
ResendSenderSignatureConfirmation resends the confirmation email for a sender signature.
func (*Client) RetryInboundMessage ¶
RetryInboundMessage - Retry a failed inbound message for processing
func (*Client) RotateDKIM ¶ added in v1.7.0
RotateDKIM Creates a new DKIM key to replace your current key. Until the new DNS entries are confirmed, the pending values will be in DKIMPendingHost and DKIMPendingTextValue fields. After the new DKIM value is verified in DNS, the pending values will migrate to DKIMTextValue and DKIMPendingTextValue and Postmark will begin to sign emails with the new DKIM key.
func (*Client) SendEmailBatch ¶
SendEmailBatch sends multiple emails together Note, individual emails in the batch can error, so it would be wise to range over the responses and sniff for errors
func (*Client) SendTemplatedEmail ¶
func (client *Client) SendTemplatedEmail(ctx context.Context, email TemplatedEmail) (EmailResponse, error)
SendTemplatedEmail sends an email using a template (TemplateID)
func (*Client) SendTemplatedEmailBatch ¶
func (client *Client) SendTemplatedEmailBatch(ctx context.Context, emails []TemplatedEmail) ([]EmailResponse, error)
SendTemplatedEmailBatch sends batch email using a template (TemplateID)
func (*Client) UnarchiveMessageStream ¶ added in v1.6.0
UnarchiveMessageStream unarchives a message stream if it has not been deleted yet. The ArchivedAt value will be null after calling this method.
func (*Client) ValidateTemplate ¶
func (client *Client) ValidateTemplate(ctx context.Context, validateTemplateBody ValidateTemplateBody) (ValidateTemplateResponse, error)
ValidateTemplate validates the provided template/render model combination
func (*Client) VerifyDKIMStatus ¶ added in v1.7.0
VerifyDKIMStatus verifies DKIM keys for the specified domain.
func (*Client) VerifyReturnPath ¶ added in v1.7.0
VerifyReturnPath verifies Return-Path DNS record for the specified domain.
type ClientInfo ¶ added in v1.7.3
type ClientInfo struct { Name string `json:"Name"` Family string `json:"Family"` Company string `json:"Company"` }
ClientInfo contains email client information
type CreateMessageStreamRequest ¶ added in v1.6.0
type CreateMessageStreamRequest struct { // ID of message stream. ID string `json:"ID"` // Name of message stream. Name string `json:"Name"` // Description of message stream. This value can be null. Description *string `json:"Description,omitempty"` // Type of message stream. MessageStreamType MessageStreamType `json:"MessageStreamType"` // Subscription management options for the Stream SubscriptionManagementConfiguration MessageStreamSubscriptionManagementConfiguration `json:"SubscriptionManagementConfiguration"` }
CreateMessageStreamRequest is the request body for CreateMessageStream. It contains only a subset of the fields of MessageStream.
type DeliveryEvent ¶ added in v1.7.3
type DeliveryEvent struct { BaseEvent ServerID int `json:"ServerID"` Recipient string `json:"Recipient"` DeliveredAt time.Time `json:"DeliveredAt"` Details string `json:"Details,omitempty"` }
DeliveryEvent represents a successful email delivery webhook event
type DeliveryStats ¶
type DeliveryStats struct { // InactiveMails: Number of inactive emails InactiveMails int64 // Bounces: List of bounce types with total counts. Bounces []BounceType }
DeliveryStats represents bounce stats
type Domain ¶ added in v1.7.0
type Domain struct { // Name of the domain. Name string `json:"Name" binding:"required"` // Deprecated: See our [blog post](https://postmarkapp.com/blog/why-we-no-longer-ask-for-spf-records) to learn // why this field was deprecated. SPFVerified bool `json:"SPFVerified"` // Specifies whether DKIM has ever been verified for the domain or not. Once DKIM is verified, this response will // stay true, even if the record is later removed from DNS. DKIMVerified bool `json:"DKIMVerified"` // DKIM is using a strength weaker than 1024 bit. If so, it’s possible to request a new DKIM using the // [RequestNewDKIM](https://postmarkapp.com/developer/api/domains-api#rotate-dkim) function below. WeakDKIM bool `json:"WeakDKIM"` // The verification state of the Return-Path domain. Tells you if the Return-Path is actively being used or still // needs further action to be used. ReturnPathDomainVerified bool `json:"ReturnPathDomainVerified"` // Unique ID of the Domain. ID int64 }
Domain is a domain in Postmark. https://postmarkapp.com/developer/api/domains-api
type DomainCreateRequest ¶ added in v1.7.0
type DomainCreateRequest struct { // Name of the domain. Name string `json:"Name" binding:"required"` // A custom value for the Return-Path domain. It is an optional field, but it must be a subdomain of your // From Email domain and must have a CNAME record that points to pm.mtasv.net. For more information about this // field, please read our [support page](http://support.postmarkapp.com/article/910-adding-a-custom-return-path-domain). ReturnPathDomain string `json:"ReturnPathDomain"` }
DomainCreateRequest is the request body to create a domain
type DomainDetails ¶ added in v1.7.0
type DomainDetails struct { // Name of the domain. Name string `json:"Name" binding:"required"` // Deprecated: See our [blog post](https://postmarkapp.com/blog/why-we-no-longer-ask-for-spf-records) to learn // why this field was deprecated. SPFVerified bool `json:"SPFVerified"` // Host name used for the SPF configuration. SPFHost string `json:"SPFHost"` // Value that can be optionally setup with your DNS host. See our // [blog post](https://postmarkapp.com/blog/why-we-no-longer-ask-for-spf-records) to learn why this field is no // longer necessary. SPFTextValue string `json:"SPFTextValue"` // Specifies whether DKIM has ever been verified for the domain or not. Once DKIM is verified, this response will // stay true, even if the record is later removed from DNS. DKIMVerified bool `json:"DKIMVerified"` // DKIM is using a strength weaker than 1024 bit. If so, it’s possible to request a new DKIM using the // [RequestNewDKIM](https://postmarkapp.com/developer/api/domains-api#rotate-dkim) function below. WeakDKIM bool `json:"WeakDKIM"` // DNS TXT host being used to validate messages sent in DKIMHost string `json:"DKIMHost"` // DNS TXT value being used to validate messages sent in. DKIMTextValue string `json:"DKIMTextValue"` // If a DKIM rotation has been initiated or this DKIM is from a new Domain, this field will show the pending // DKIM DNS TXT host which has yet to be setup and confirmed at your registrar or DNS host. DKIMPendingHost string `json:"DKIMPendingHost"` // Similar to the DKIMPendingHost field, this will show the DNS TXT value waiting to be confirmed at your // registrar or DNS host. DKIMPendingTextValue string `json:"DKIMPendingTextValue"` // Once a new DKIM has been confirmed at your registrar or DNS host, Postmark will revoke the old DKIM host in // preparation for removing it permanently from the system. DKIMRevokedHost string `json:"DKIMRevokedHost"` // Similar to DKIMRevokedHost, this field will show the DNS TXT value that will soon be removed from the Postmark system. DKIMRevokedTextValue string `json:"DKIMRevokedTextValue"` // Indicates whether you may safely delete the old DKIM DNS TXT records at your registrar or DNS host. The new // DKIM is now safely in use. SafeToRemoveRevokedKeyFromDNS bool `json:"SafeToRemoveRevokedKeyFromDNS"` // While DKIM renewal or new DKIM operations are being conducted or setup, this field will indicate Pending. // After all DNS TXT records are up to date and any pending renewal operations are finished, it will indicate Verified. DKIMUpdateStatus string `json:"DKIMUpdateStatus"` // The custom Return-Path for this domain, please [read our support page](http://support.postmarkapp.com/article/910-adding-a-custom-return-path-domain). ReturnPathDomain string `json:"ReturnPathDomain"` // The verification state of the Return-Path domain. Tells you if the Return-Path is actively being used or still // needs further action to be used. ReturnPathDomainVerified bool `json:"ReturnPathDomainVerified"` // The CNAME DNS record that Postmark expects to find at the ReturnPathDomain value. ReturnPathDomainCNAMEValue string `json:"ReturnPathDomainCNAMEValue"` // Unique ID of the Domain. ID int64 }
DomainDetails contains the full details of a domain in Postmark. https://postmarkapp.com/developer/api/domains-api
type DomainEditRequest ¶ added in v1.7.0
type DomainEditRequest struct { // A custom value for the Return-Path domain. It is an optional field, but it must be a subdomain of your // From Email domain and must have a CNAME record that points to pm.mtasv.net. For more information about this // field, please read our [support page](http://support.postmarkapp.com/article/910-adding-a-custom-return-path-domain). ReturnPathDomain string `json:"ReturnPathDomain"` }
DomainEditRequest is the request body to edit a domain
type DomainsList ¶ added in v1.7.0
DomainsList is just a list of Domains as they are in the response
type EditMessageStreamRequest ¶ added in v1.6.0
type EditMessageStreamRequest struct { // Name of message stream. Name string `json:"Name"` // Description of message stream. This value can be null. Description *string `json:"Description,omitempty"` // Subscription management options for the Stream SubscriptionManagementConfiguration MessageStreamSubscriptionManagementConfiguration `json:"SubscriptionManagementConfiguration"` }
EditMessageStreamRequest is the request body for EditMessageStream. It contains only a subset of the fields of MessageStream.
type Email ¶
type Email struct { // From: REQUIRED The sender email address. Must have a registered and confirmed Sender Signature. From string `json:",omitempty"` // To: REQUIRED Recipient email address. Multiple addresses are comma separated. Max 50. To string `json:",omitempty"` // Cc recipient email address. Multiple addresses are comma separated. Max 50. Cc string `json:",omitempty"` // Bcc recipient email address. Multiple addresses are comma separated. Max 50. Bcc string `json:",omitempty"` // Subject: Email subject Subject string `json:",omitempty"` // Tag: Email tag that allows you to categorize outgoing emails and get detailed statistics. Tag string `json:",omitempty"` // HTMLBody: HTML email message. REQUIRED, If no TextBody specified HTMLBody string `json:"HtmlBody,omitempty"` // TextBody: Plain text email message. REQUIRED, If no HTMLBody specified TextBody string `json:",omitempty"` // ReplyTo: Reply To override email address. Defaults to the Reply To set in the sender signature. ReplyTo string `json:",omitempty"` // Headers: List of custom headers to include. Headers []Header `json:",omitempty"` // TrackOpens: Activate open tracking for this email. TrackOpens bool `json:",omitempty"` // TrackLinks:Activate link tracking for links in the HTML or Text bodies of this email. Possible options: None HtmlAndText HtmlOnly TextOnly TrackLinks string `json:",omitempty"` // Attachments: List of attachments Attachments []Attachment `json:",omitempty"` // Metadata: metadata Metadata map[string]string `json:",omitempty"` // MessageStream: MessageStream will default to the outbound message stream ID (Default Transactional Stream) if no message stream ID is provided. MessageStream string `json:",omitempty"` }
Email is exactly what it sounds like
type EmailResponse ¶
type EmailResponse struct { // To: Recipient email address To string // SubmittedAt: Timestamp SubmittedAt time.Time // MessageID: ID of message MessageID string // ErrorCode: see error codes here (https://postmarkapp.com/developer/api/overview#error-codes) ErrorCode int64 // Message: Response message Message string }
EmailResponse holds info in response to a send/send-batch request Even if API request comes back successful, check the ErrorCode to see if there might be a delivery problem
type GeoInfo ¶ added in v1.7.3
type GeoInfo struct { IP string `json:"IP"` City string `json:"City"` Country string `json:"Country"` CountryISOCode string `json:"CountryISOCode"` Region string `json:"Region"` RegionISOCode string `json:"RegionISOCode"` Zip string `json:"Zip"` Coords string `json:"Coords"` }
GeoInfo contains geographical information
type Header ¶
type Header struct { // Name: header name Name string `json:",omitempty"` // Value: header value Value string `json:",omitempty"` }
Header - an email header
type InboundMessage ¶
type InboundMessage struct { // From - The sender email address. From string // FromName - The sender name. FromName string // FromFull - Sender email address and name. FromFull Recipient // To - Inbound address the message was sent to. To string // ToFull - Slice of all TO recipients ToFull []Recipient // CcFull - Slice of all CC recipients CcFull []Recipient // Cc - Cc recipient email address. Cc string // ReplyTo - Reply to override email address. ReplyTo string // OriginalRecipient - Receiver (RCPT TO) address this webhook is for. OriginalRecipient string // Subject - Email subject Subject string // Date - Timestamp Date string // MailboxHash - Custom hash that the email was sent to. MailboxHash string // TextBody - Plain text email message. TextBody string // HTMLBody - HTML email message. HTMLBody string `json:"HtmlBody"` // Tag - Tag name Tag string // Headers - List of objects that each represent a header name and value. Headers []Header // Attachments - List of objects that each represent an attachment. Attachments []Attachment // MessageID - Unique ID of the message. MessageID string // BlockedReason - Reason message was blocked. BlockedReason string // Status - Status of message in your Postmark activity. Status string }
InboundMessage - a message received from the Postmark server
type MessageEvent ¶
type MessageEvent struct { // Recipient is who received the message (just email address) Recipient string // ReceivedAt is the event timestamp ReceivedAt time.Time // Type of event (Delivered, Opened, or Bounced) Type string // Details contain information regarding the event // http://developer.postmarkapp.com/developer-api-messages.html#outbound-message-details Details map[string]string }
MessageEvent represents things that have happened to a message.
type MessageStream ¶ added in v1.6.0
type MessageStream struct { // ID of message stream. ID string `json:"ID"` // ID of server the message stream is associated with. ServerID int `json:"ServerID"` // Name of message stream. Name string `json:"Name"` // Description of message stream. This value can be null. Description *string `json:"Description,omitempty"` // Type of message stream. MessageStreamType MessageStreamType `json:"MessageStreamType"` // Timestamp when message stream was created. CreatedAt string `json:"CreatedAt"` // Timestamp when message stream was last updated. This value can be null. UpdatedAt *string `json:"UpdatedAt,omitempty"` // Timestamp when message stream was archived. This value can be null. ArchivedAt *string `json:"ArchivedAt,omitempty"` // Archived streams are deleted 45 days after archiving date. Until this // date, it can be restored. This value is null if the stream is not // archived. ExpectedPurgeDate *string `json:"ExpectedPurgeDate,omitempty"` // Subscription management options for the Stream SubscriptionManagementConfiguration MessageStreamSubscriptionManagementConfiguration `json:"SubscriptionManagementConfiguration"` }
MessageStream holes the configuration for a message stream on a server. https://postmarkapp.com/developer/api/message-streams-api
type MessageStreamSubscriptionManagementConfiguration ¶ added in v1.6.0
type MessageStreamSubscriptionManagementConfiguration struct { // The unsubscribe management option used for the Stream. Broadcast Message // Streams require unsubscribe management, Postmark is default. For Inbound // and Transactional Streams default is none. UnsubscribeHandlingType MessageStreamUnsubscribeHandlingType `json:"UnsubscribeHandlingType"` }
MessageStreamSubscriptionManagementConfiguration is the configuration for subscriptions to the message stream.
type MessageStreamType ¶ added in v1.6.0
type MessageStreamType string
MessageStreamType is an Enum representing the type of a message stream.
type MessageStreamUnsubscribeHandlingType ¶ added in v1.6.0
type MessageStreamUnsubscribeHandlingType string
MessageStreamUnsubscribeHandlingType is an Enum with the possible values for the unsubscribe handling in a message stream.
type OSInfo ¶ added in v1.7.3
type OSInfo struct { Name string `json:"Name"` Family string `json:"Family"` Company string `json:"Company"` }
OSInfo contains operating system information
type Open ¶
type Open struct { // FirstOpen - Indicates if the open was first open of message with MessageID and by Recipient. Any subsequent opens of the same message by the same Recipient will show false in this field. Postmark only saves first opens to its store, while all opens are available via Open web hooks. FirstOpen bool // UserAgent - Full user-agent header passed by the client software to Postmark. Postmark will fill in the Platform Client and OS fields based on this. UserAgent string // MessageID - Unique ID of the message. MessageID string // Client - Shows the email client (or browser) used to open the email. Name company and family are described in the parameters specification for this endpoint. Client map[string]string // OS - Shows the operating system used to open the email. OS map[string]string // Platform - Shows what platform was used to open the email. WebMail Desktop Mobile Unknown Platform string // ReadSeconds - Shows the reading time in seconds ReadSeconds int64 // Geo - Contains IP of the recipient’s machine where the email was opened and the information based on that IP - geo coordinates (Coordinates) and country, region, city and zip. Geo map[string]string }
Open represents a single email open.
type OpenCounts ¶
type OpenCounts struct { // Days - List of objects that each represent opens by date. Days []OpenedDay // Opens - Indicates total number of opened emails. This total includes recipients who opened your email multiple times. Opens int64 // Unique int64 - Indicates total number of uniquely opened emails. Unique int64 }
OpenCounts - opened outbound emails for a period
type OpenEvent ¶ added in v1.7.3
type OpenEvent struct { BaseEvent FirstOpen bool `json:"FirstOpen"` Recipient string `json:"Recipient"` ReceivedAt time.Time `json:"ReceivedAt"` Platform string `json:"Platform"` ReadSeconds int `json:"ReadSeconds"` UserAgent string `json:"UserAgent"` OS OSInfo `json:"OS"` Client ClientInfo `json:"Client"` Geo GeoInfo `json:"Geo"` }
OpenEvent represents an email open webhook event
type OpenedDay ¶
type OpenedDay struct { // Date - self-explanatory Date string // Opens - Indicates total number of opened emails. This total includes recipients who opened your email multiple times. Opens int64 // Unique - Indicates total number of uniquely opened emails. Unique int64 }
OpenedDay - opened outbound emails sent on a specific day
type OutboundMessage ¶
type OutboundMessage struct { // TextBody - Text body of the message. TextBody string // HTMLBody - Html body of the message. HTMLBody string `json:"HtmlBody"` // Body - Raw source of the message. Body string // Tag - Tags associated with this message. Tag string // MessageID - Unique ID of the message. MessageID string // To - List of objects that contain To recipients. To []Recipient // Cc - List of objects that contain Cc recipients. Cc []Recipient // Bcc - List of objects that contain Bcc recipients. Bcc []Recipient // Recipients - List of recipients (just emails) Recipients []string // ReceivedAt - Timestamp ReceivedAt time.Time // From - The sender email address. From string // Subject - Email subject Subject string // Attachments - List of objects that each represent an attachment. Attachments []string // Status - Status of message in your Postmark activity. Status string // MessageEvents - List of summaries (MessageEvent) of things that have happened to this message. They can be Delivered, Opened, or Bounced as shown in the type field. MessageEvents []MessageEvent }
OutboundMessage - a message sent from the Postmark server
type OutboundStats ¶
type OutboundStats struct { // Sent - Number of sent emails Sent int64 // Bounced - Number of bounced emails Bounced int64 // SMTPApiErrors - Number of SMTP errors SMTPApiErrors int64 // BounceRate - Bounce rate percentage calculated by total sent. BounceRate float64 // SpamComplaints - Number of spam complaints received SpamComplaints int64 // SpamComplaintsRate - Spam complaints percentage calculated by total sent. SpamComplaintsRate float64 // Opens - Number of opens Opens int64 // UniqueOpens - Number of unique opens UniqueOpens int64 // Tracked - Number of tracked emails sent Tracked int64 // WithClientRecorded - Number of emails where the client was successfully tracked. WithClientRecorded int64 // WithPlatformRecorded - Number of emails where platform was successfully tracked. WithPlatformRecorded int64 // WithReadTimeRecorded - Number of emails where read time was successfully tracked. WithReadTimeRecorded int64 }
OutboundStats - a brief overview of statistics for all of your outbound email.
type PlatformCounts ¶
type PlatformCounts struct { // Days - List of objects that each represent email platform usages by date Days []PlatformDay // Desktop - The total number of email platform usages by Desktop Desktop int64 // Mobile - The total number of email platform usages by Mobile Mobile int64 // Unknown - The total number of email platform usages by others Unknown int64 // WebMail - The total number of email platform usages by WebMail WebMail int64 }
PlatformCounts contains day-to-day usages, along with totals of email usages by platform
type PlatformDay ¶
type PlatformDay struct { // Date - the date in question Date string // Desktop - The total number of email platform usages by Desktop for this date Desktop int64 // Mobile - The total number of email platform usages by Mobile for this date Mobile int64 // Unknown - The total number of email platform usages by others for this date Unknown int64 // WebMail - The total number of email platform usages by WebMail for this date WebMail int64 }
PlatformDay contains the totals of email usages by platform for a specific date
type Recipient ¶
type Recipient struct { // Name is the recipient's name Name string // Emails is the recipient's email address Email string }
Recipient represents an individual who received a message
type SendCounts ¶
type SendCounts struct { // Days - List of objects that each represent sent counts by date. Days []SendDay // Sent - Indicates the number of total sent emails returned. Sent int64 }
SendCounts - send stats for a period
type SendDay ¶
type SendDay struct { // Date - self-explanatory Date string // Sent - number of emails sent Sent int64 }
SendDay - send stats for a specific day
type SenderSignature ¶
type SenderSignature struct { // Domain associated with sender signature. Domain string `json:"Domain"` // Email address associated with sender signature. FromEmail string `json:"EmailAddress"` // Reply-To email associated with sender signature. ReplyToEmail string `json:"ReplyToEmailAddress"` // From name of sender signature. Name string `json:"Name"` // Indicates whether this sender signature has been confirmed. Confirmed bool `json:"Confirmed"` // Unique ID of sender signature. ID int64 `json:"ID"` }
SenderSignature contains the brief details of a sender signature associated with your account.
type SenderSignatureCreateRequest ¶ added in v1.7.0
type SenderSignatureCreateRequest struct { // From email associated with sender signature. FromEmail string `json:"FromEmail" binding:"required"` // From name associated with sender signature. Name string `json:"Name" binding:"required"` // Override for reply-to address. ReplyToEmail string `json:"ReplyToEmail"` // A custom value for the Return-Path domain. It is an optional field, but it must be a subdomain of your From // Email domain and must have a CNAME record that points to pm.mtasv.net. For more information about this field, // please [read our support page](http://support.postmarkapp.com/article/910-adding-a-custom-return-path-domain). ReturnPathDomain string `json:"ReturnPathDomain"` // Optional. A way to provide a note to the recipient of the confirmation email to have context of what Postmark is. // Max length of 400 characters. ConfirmationPersonalNote string `json:"ConfirmationPersonalNote"` }
SenderSignatureCreateRequest is the request body for creating a new sender signature
type SenderSignatureDetails ¶ added in v1.7.0
type SenderSignatureDetails struct { // Domain associated with sender signature. Domain string `json:"Domain"` // Email address associated with sender signature. FromEmail string `json:"EmailAddress"` // Reply-To email associated with sender signature. ReplyToEmail string `json:"ReplyToEmailAddress"` // From name of sender signature. Name string `json:"Name"` // Indicates whether this sender signature has been confirmed. Confirmed bool `json:"Confirmed"` // Deprecated: See our [blog post](https://postmarkapp.com/blog/why-we-no-longer-ask-for-spf-records) to learn // why this field was deprecated. SPFVerified bool `json:"SPFVerified"` // Host name used for the SPF configuration. SPFHost string `json:"SPFHost"` // Value that can be optionally setup with your DNS host. // See our [blog post](https://postmarkapp.com/blog/why-we-no-longer-ask-for-spf-records) to learn why this field is no longer necessary. SPFTextValue string `json:"SPFTextValue"` // Specifies whether DKIM has ever been verified for the domain or not. Once DKIM is verified, this response will // stay true, even if the record is later removed from DNS. DKIMVerified bool `json:"DKIMVerified"` // DKIM is using a strength weaker than 1024 bit. If so, it’s possible to request a new DKIM using the // [RequestNewDKIM](https://postmarkapp.com/developer/api/signatures-api#request-dkim) function below. WeakDKIM bool `json:"WeakDKIM"` // DNS TXT host being used to validate messages sent in. DKIMHost string `json:"DKIMHost"` // DNS TXT value being used to validate messages sent in. DKIMTextValue string `json:"DKIMTextValue"` // If a DKIM renewal has been initiated or this DKIM is from a new Sender Signature, this field will show the pending // DKIM DNS TXT host which has yet to be setup and confirmed at your registrar or DNS host. DKIMPendingHost string `json:"DKIMPendingHost"` // Similar to the DKIMPendingHost field, this will show the DNS TXT value waiting to be confirmed at your registrar // or DNS host. DKIMPendingTextValue string `json:"DKIMPendingTextValue"` // Once a new DKIM has been confirmed at your registrar or DNS host, Postmark will revoke the old DKIM host in // preparation for removing it permanently from the system. DKIMRevokedHost string `json:"DKIMRevokedHost"` // Similar to DKIMRevokedHost, this field will show the DNS TXT value that will soon be removed from the Postmark system. DKIMRevokedTextValue string `json:"DKIMRevokedTextValue"` // Indicates whether you may safely delete the old DKIM DNS TXT records at your registrar or DNS host. // The new DKIM is now safely in use. SafeToRemoveRevokedKeyFromDNS bool `json:"SafeToRemoveRevokedKeyFromDNS"` // While DKIM renewal or new DKIM operations are being conducted or setup, this field will indicate Pending. After // all DNS TXT records are up to date and any pending renewal operations are finished, it will indicate Verified. DKIMUpdateStatus string `json:"DKIMUpdateStatus"` // The custom Return-Path domain for this signature. For more information about this field, please // [read our support page](http://support.postmarkapp.com/article/910-adding-a-custom-return-path-domain). ReturnPathDomain string `json:"ReturnPathDomain"` // The verification state of the Return-Path domain. Tells you if the Return-Path is actively being used or // still needs further action to be used. ReturnPathDomainVerified bool `json:"ReturnPathDomainVerified"` // The CNAME DNS record that Postmark expects to find at the ReturnPathDomain value. ReturnPathDomainCNAMEValue string `json:"ReturnPathDomainCNAMEValue"` // Unique ID of sender signature. ID int64 `json:"ID"` // The text of the personal note sent to the recipient. ConfirmationPersonalNote string `json:"ConfirmationPersonalNote"` }
SenderSignatureDetails contains the full details of a sender signature associated with your account.
type SenderSignatureEditRequest ¶ added in v1.7.0
type SenderSignatureEditRequest struct { // From name associated with sender signature. Name string `json:"Name" binding:"required"` // Override for reply-to address. ReplyToEmail string `json:"ReplyToEmail"` // A custom value for the Return-Path domain. It is an optional field, but it must be a subdomain of your From // Email domain and must have a CNAME record that points to pm.mtasv.net. For more information about this field, // please [read our support page](http://support.postmarkapp.com/article/910-adding-a-custom-return-path-domain). ReturnPathDomain string `json:"ReturnPathDomain"` // Optional. A way to provide a note to the recipient of the confirmation email to have context of what Postmark is. // Max length of 400 characters. ConfirmationPersonalNote string `json:"ConfirmationPersonalNote"` }
SenderSignatureEditRequest is the request body for editing an existing sender signature
type SenderSignaturesList ¶
type SenderSignaturesList struct { TotalCount int SenderSignatures []SenderSignature }
SenderSignaturesList is just a list of SenderSignatures as they are in the response
type Server ¶
type Server struct { // ID of server ID int64 `json:"ID"` // Name of server Name string `json:"Name"` // APITokens associated with server. APITokens []string `json:"ApiTokens"` // ServerLink to your server overview page in Postmark. ServerLink string `json:"ServerLink"` // Color of the server in the rack screen. Purple Blue Turquoise Green Red Yellow Grey Color string `json:"Color"` // SMTPAPIActivated specifies whether SMTP is enabled on this server. SMTPAPIActivated bool `json:"SmtpApiActivated"` // RawEmailEnabled allows raw email to be sent with inbound. RawEmailEnabled bool `json:"RawEmailEnabled"` // DeliveryType specifies the type of environment for your server: Live or Sandbox, defaults to Live DeliveryType string `json:"DeliveryType"` // InboundAddress is the inbound email address InboundAddress string `json:"InboundAddress"` // InboundHookURL to POST to every time an inbound event occurs. InboundHookURL string `json:"InboundHookUrl"` // Deprecated: Use the Bounce Webhook API instead. BounceHookURL string `json:"BounceHookUrl"` // Deprecated: Use the Open Tracking Webhook API instead. OpenHookURL string `json:"OpenHookUrl"` // Deprecated: Use the Delivery Webhook API instead. DeliveryHookURL string `json:"DeliveryHookUrl"` // PostFirstOpenOnly - If set to true, only the first open by a particular recipient will initiate the open webhook. Any // subsequent opens of the same email by the same recipient will not initiate the webhook. PostFirstOpenOnly bool `json:"PostFirstOpenOnly"` // TrackOpens indicates if all emails being sent through this server have open tracking enabled. TrackOpens bool `json:"TrackOpens"` // TrackLinks specifies link tracking in emails: None, HtmlAndText, HtmlOnly, TextOnly, defaults to "None" TrackLinks string `json:"TrackLinks"` // IncludeBounceContentInHook determines if bounce content is included in webhook. IncludeBounceContentInHook bool `json:"IncludeBounceContentInHook"` // InboundDomain is the inbound domain for MX setup InboundDomain string `json:"InboundDomain"` // InboundHash is the inbound hash of your inbound email address. InboundHash string `json:"InboundHash"` // InboundSpamThreshold is the maximum spam score for an inbound message before it's blocked. InboundSpamThreshold int64 `json:"InboundSpamThreshold"` // EnableSMTPAPIErrorHooks specifies whether SMTP API Errors will be included with bounce webhooks. EnableSMTPAPIErrorHooks bool `json:"EnableSmtpApiErrorHooks"` }
Server represents a server registered in your Postmark account
func (Server) MarshalJSON ¶ added in v1.6.7
MarshalJSON customizes the JSON representation of the Server struct by setting default values for specific fields.
type ServerCreateRequest ¶ added in v1.7.0
type ServerCreateRequest struct { // Name of server Name string `json:"Name" binding:"required"` // Color of the server in the server list, for quick identification. Purple Blue Turquoise Green Red Yellow Grey Orange Color string `json:"Color"` // SMTPAPIActivated specifies whether SMTP is enabled on this server. SMTPAPIActivated bool `json:"SmtpApiActivated"` // When enabled, the raw email content will be included with inbound webhook payloads under the RawEmail key. RawEmailEnabled bool `json:"RawEmailEnabled"` // Specifies the type of environment for your server. Possible options: Live Sandbox. Defaults to Live if not // specified. This cannot be changed after the server has been created. DeliveryType string `json:"DeliveryType"` // URL to POST to every time an inbound event occurs. InboundHookURL string `json:"InboundHookUrl"` // Deprecated: Use the Bounce Webhook API instead. BounceHookURL string `json:"BounceHookUrl"` // Deprecated: Use the Open Tracking Webhook API instead. OpenHookURL string `json:"OpenHookUrl"` // Deprecated: Use the Delivery Webhook API instead. DeliveryHookURL string `json:"DeliveryHookUrl"` // Deprecated: Use the Click Webhook API instead. ClickHookURL string `json:"ClickHookUrl"` // PostFirstOpenOnly - If set to true, only the first open by a particular recipient will initiate the open webhook. Any // subsequent opens of the same email by the same recipient will not initiate the webhook. PostFirstOpenOnly bool `json:"PostFirstOpenOnly"` // InboundDomain is the inbound domain for MX setup InboundDomain string `json:"InboundDomain"` // InboundSpamThreshold is the maximum spam score for an inbound message before it's blocked. InboundSpamThreshold int64 `json:"InboundSpamThreshold"` // TrackOpens indicates if all emails being sent through this server have open tracking enabled. TrackOpens bool `json:"TrackOpens"` // TrackLinks specifies link tracking in emails: None, HtmlAndText, HtmlOnly, TextOnly, defaults to "None" TrackLinks string `json:"TrackLinks"` // IncludeBounceContentInHook determines if bounce content is included in webhook. IncludeBounceContentInHook bool `json:"IncludeBounceContentInHook"` // EnableSMTPAPIErrorHooks specifies whether SMTP API Errors will be included with bounce webhooks. EnableSMTPAPIErrorHooks bool `json:"EnableSmtpApiErrorHooks"` }
ServerCreateRequest represents the fields to create a server
type ServerEditRequest ¶ added in v1.7.0
type ServerEditRequest struct { // Name of server Name string `json:"Name" binding:"required"` // Color of the server in the server list, for quick identification. Purple Blue Turquoise Green Red Yellow Grey Orange Color string `json:"Color"` // SMTPAPIActivated specifies whether SMTP is enabled on this server. SMTPAPIActivated bool `json:"SmtpApiActivated"` // When enabled, the raw email content will be included with inbound webhook payloads under the RawEmail key. RawEmailEnabled bool `json:"RawEmailEnabled"` // URL to POST to every time an inbound event occurs. InboundHookURL string `json:"InboundHookUrl"` // Deprecated: Use the Bounce Webhook API instead. BounceHookURL string `json:"BounceHookUrl"` // Deprecated: Use the Open Tracking Webhook API instead. OpenHookURL string `json:"OpenHookUrl"` // Deprecated: Use the Delivery Webhook API instead. DeliveryHookURL string `json:"DeliveryHookUrl"` // Deprecated: Use the Click Webhook API instead. ClickHookURL string `json:"ClickHookUrl"` // PostFirstOpenOnly - If set to true, only the first open by a particular recipient will initiate the open webhook. Any // subsequent opens of the same email by the same recipient will not initiate the webhook. PostFirstOpenOnly bool `json:"PostFirstOpenOnly"` // InboundDomain is the inbound domain for MX setup InboundDomain string `json:"InboundDomain"` // InboundSpamThreshold is the maximum spam score for an inbound message before it's blocked. InboundSpamThreshold int64 `json:"InboundSpamThreshold"` // TrackOpens indicates if all emails being sent through this server have open tracking enabled. TrackOpens bool `json:"TrackOpens"` // TrackLinks specifies link tracking in emails: None, HtmlAndText, HtmlOnly, TextOnly, defaults to "None" TrackLinks string `json:"TrackLinks"` // IncludeBounceContentInHook determines if bounce content is included in webhook. IncludeBounceContentInHook bool `json:"IncludeBounceContentInHook"` // EnableSMTPAPIErrorHooks specifies whether SMTP API Errors will be included with bounce webhooks. EnableSMTPAPIErrorHooks bool `json:"EnableSmtpApiErrorHooks"` }
ServerEditRequest represents the fields that can be updated for a server
type ServersList ¶ added in v1.7.0
ServersList is just a list of Server as they are in the response
type SpamComplaintEvent ¶ added in v1.7.3
type SpamComplaintEvent struct { BaseEvent ID int `json:"ID"` Type string `json:"Type"` TypeCode int `json:"TypeCode"` Name string `json:"Name"` ServerID int `json:"ServerID"` Description string `json:"Description"` Details string `json:"Details,omitempty"` Email string `json:"Email"` From string `json:"From"` BouncedAt time.Time `json:"BouncedAt"` DumpAvailable bool `json:"DumpAvailable"` Inactive bool `json:"Inactive"` CanActivate bool `json:"CanActivate"` Subject string `json:"Subject"` Content string `json:"Content"` }
SpamComplaintEvent represents a spam complaint webhook event
type SpamCounts ¶
type SpamCounts struct { // Days - List of objects that each represent spam complaint counts by date. Days []SpamDay // SpamComplaint - Indicates total number of spam complaints. SpamComplaint int64 }
SpamCounts - spam complaints for a period
type SpamDay ¶
type SpamDay struct { // Date - self-explanatory Date string // SpamComplaint - number of spam complaints received SpamComplaint int64 }
SpamDay - spam complaints for a specific day
type SubscriptionChangeEvent ¶ added in v1.7.3
type SubscriptionChangeEvent struct { BaseEvent ServerID int `json:"ServerID"` ChangedAt time.Time `json:"ChangedAt"` Recipient string `json:"Recipient"` Origin string `json:"Origin"` SuppressSending bool `json:"SuppressSending"` SuppressionReason string `json:"SuppressionReason,omitempty"` }
SubscriptionChangeEvent represents a subscription change webhook event
type Suppression ¶ added in v1.4.0
type Suppression struct { // EmailAddress is the address that is suppressed (can't be emailed any more) EmailAddress string // SuppressionReason is why the email address was added to the suppression list. // Possible options: HardBounce, SpamComplaint, ManualSuppression SuppressionReason SuppressionReasonType // Origin describes who added the email address to the suppression list. // Possible options: Recipient, Customer, Admin. Origin OriginType // CreatedAt is when the email address was added to the suppression list. CreatedAt time.Time }
Suppression contains a suppressed email address for a particular message stream.
type SuppressionReasonType ¶ added in v1.4.0
type SuppressionReasonType string
SuppressionReasonType - The reason type of suppression
type SuppressionResponse ¶ added in v1.6.3
type SuppressionResponse struct { // EmailAddress is the address that is suppressed (can't be emailed any more) EmailAddress string // Status of suppression creation or deletion. Status SuppressionUpdateStatus // If address cannot be suppressed or deleted (Status: Failed), the cause for failure is listed. // Otherwise, this field is null. Message string }
SuppressionResponse contains a status of suppression creation or deletion.
type SuppressionUpdateStatus ¶ added in v1.6.3
type SuppressionUpdateStatus string
SuppressionUpdateStatus - The status of suppression update
type Template ¶
type Template struct { // TemplateID: ID of template TemplateID int64 `json:"TemplateID"` // Name: Name of template Name string // Subject: The content to use for the Subject when this template is used to send email. Subject string // HTMLBody: The content to use for the HTMLBody when this template is used to send email. HTMLBody string `json:"HtmlBody"` // TextBody: The content to use for the TextBody when this template is used to send email. TextBody string // AssociatedServerID: The ID of the Server with which this template is associated. AssociatedServerID int64 `json:"AssociatedServerId"` // Active: Indicates that this template may be used for sending email. Active bool }
Template represents an email template on the server
type TemplateInfo ¶
type TemplateInfo struct { // TemplateID: ID of template TemplateID int64 `json:"TemplateID"` // Name: Name of template Name string // Active: Indicates that this template may be used for sending email. Active bool }
TemplateInfo is a limited set of template info returned via Index/Editing endpoints
type TemplatedEmail ¶
type TemplatedEmail struct { // TemplateID: REQUIRED if TemplateAlias is not specified. - The template id to use when sending this message. TemplateID int64 `json:"TemplateId,omitempty"` // TemplateAlias: REQUIRED if TemplateID is not specified. - The template alias to use when sending this message. TemplateAlias string `json:",omitempty"` // TemplateModel: The model to be applied to the specified template to generate HtmlBody, TextBody, and Subject. TemplateModel map[string]interface{} `json:",omitempty"` // InlineCSS: By default, if the specified template contains an HtmlBody, we will apply the style blocks as inline attributes to the rendered HTML content. You may opt out of this behavior by passing false for this request field. InlineCSS bool `json:"InlineCSS,omitempty"` // From: The sender email address. Must have a registered and confirmed Sender Signature. From string `json:",omitempty"` // To: REQUIRED Recipient email address. Multiple addresses are comma separated. Max 50. To string `json:",omitempty"` // Cc recipient email address. Multiple addresses are comma separated. Max 50. Cc string `json:",omitempty"` // Bcc recipient email address. Multiple addresses are comma separated. Max 50. Bcc string `json:",omitempty"` // Tag: Email tag that allows you to categorize outgoing emails and get detailed statistics. Tag string `json:",omitempty"` // Reply To override email address. Defaults to the Reply To set in the sender signature. ReplyTo string `json:",omitempty"` // Headers: List of custom headers to include. Headers []Header `json:",omitempty"` // TrackOpens: Activate open tracking for this email. TrackOpens bool `json:",omitempty"` // TrackLinks: Activate link tracking. Possible options: "None", "HtmlAndText", "HtmlOnly", "TextOnly". TrackLinks string `json:",omitempty"` // Attachments: List of attachments Attachments []Attachment `json:",omitempty"` // MessageStream: MessageStream will default to the outbound message stream ID (Default Transactional Stream) if no message stream ID is provided. MessageStream string `json:",omitempty"` // Metadata: Custom metadata key/value pairs. Metadata map[string]interface{} `json:",omitempty"` }
TemplatedEmail is used to send an email via a template
type TrackedCounts ¶
type TrackedCounts struct { // Days - List of objects that each represent tracked email counts by date. Days []TrackedDay // Tracked - Indicates total number of tracked emails sent. Tracked int64 }
TrackedCounts - tracked emails sent for a period
type TrackedDay ¶
type TrackedDay struct { // Date - self-explanatory Date string // Tracked - number of emails tracked sent Tracked int64 }
TrackedDay - tracked emails sent on a specific day
type ValidateTemplateBody ¶
type ValidateTemplateBody struct { Subject string TextBody string HTMLBody string `json:"HTMLBody"` TestRenderModel map[string]interface{} InlineCSSForHTMLTestRender bool `json:"InlineCssForHtmlTestRender"` }
ValidateTemplateBody contains the template/render model combination to be validated
type ValidateTemplateResponse ¶
type ValidateTemplateResponse struct { AllContentIsValid bool HTMLBody Validation `json:"HTMLBody"` TextBody Validation Subject Validation SuggestedTemplateModel map[string]interface{} }
ValidateTemplateResponse contains information as to how the validation went
type Validation ¶
type Validation struct { ContentIsValid bool ValidationErrors []ValidationError RenderedContent string }
Validation contains the results of a field's validation
type ValidationError ¶
ValidationError contains information about the errors which occurred during validation for a given field
type Webhook ¶ added in v1.5.0
type Webhook struct { // ID of webhook. ID int `json:"ID,omitempty"` // Your webhook URL. URL string `json:"Url"` // The stream this webhook is associated with. MessageStream string `json:"MessageStream"` // Optional. HTTP Auth username and password. HTTPAuth *WebhookHTTPAuth `json:"HttpAuth,omitempty"` // Optional. List of custom headers included. HTTPHeaders []Header `json:"HttpHeaders,omitempty"` // List of different possible triggers a webhook can be enabled/disabled for. Triggers WebhookTrigger `json:"Triggers"` }
Webhook is a configured webhook on a message stream. https://postmarkapp.com/developer/api/webhooks-api#get-a-webhook
type WebhookHTTPAuth ¶ added in v1.5.0
type WebhookHTTPAuth struct { // HTTP Auth username. Username string `json:"Username"` // HTTP Auth password. Password string `json:"Password"` }
WebhookHTTPAuth is an optional set of auth configuration to use when calling the webhook.
type WebhookTrigger ¶ added in v1.5.0
type WebhookTrigger struct { // List of open webhook details. Open WebhookTriggerOpen `json:"Open"` // List of click webhook details. Click WebhookTriggerEnabled `json:"Click"` // List of delivery webhook details. Delivery WebhookTriggerEnabled `json:"Delivery"` // List of bounce webhook details. Bounce WebhookTriggerIncContent `json:"Bounce"` // List of spam complaint webhook details. SpamComplaint WebhookTriggerIncContent `json:"SpamComplaint"` // List of subscription change webhook details. SubscriptionChange WebhookTriggerEnabled `json:"SubscriptionChange"` }
WebhookTrigger holds configuration for when this webhook should be called.
type WebhookTriggerEnabled ¶ added in v1.5.0
type WebhookTriggerEnabled struct { // Specifies whether this webhook is enabled. Enabled bool `json:"Enabled"` }
WebhookTriggerEnabled holds configuration for webhooks which can only be enabled or disabled.
type WebhookTriggerIncContent ¶ added in v1.5.0
type WebhookTriggerIncContent struct { WebhookTriggerEnabled // Specifies whether the full content of the email is included in webhook POST. IncludeContent bool `json:"IncludeContent"` }
WebhookTriggerIncContent holds configuration for webhooks which can be enabled/disabled and optionally include message contents.
type WebhookTriggerOpen ¶ added in v1.5.0
type WebhookTriggerOpen struct { WebhookTriggerEnabled PostFirstOpenOnly bool `json:"PostFirstOpenOnly"` }
WebhookTriggerOpen holds configuration for the Open webhook.