postmark

package module
v1.8.4 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Feb 18, 2026 License: MIT Imports: 12 Imported by: 17

README ΒΆ

πŸ“¨Β Β postmark

Unofficial Golang Library for the Postmark API.


Release Go Version License


CI / CD Β Β  Build Last Commit Β Β Β Β  Quality Β Β  Go Report Coverage
Security Β Β  Scorecard Security Β Β Β Β  Community Β Β  Contributors Bitcoin


Project Navigation
πŸš€Β Installation πŸ§ͺΒ ExamplesΒ &Β Tests πŸ“šΒ Documentation
🀝 Contributing πŸ› οΈΒ CodeΒ Standards ⚑ Benchmarks
πŸ€–Β AIΒ Usage βš–οΈΒ License πŸ‘₯Β Maintainers

πŸ“¦ Installation

postmark requires a supported release of Go.

go get github.com/mrz1836/postmark

πŸ’‘ Usage

Grab your Server Token, and your Account Token.

package main

import (
	"context"

	"github.com/mrz1836/postmark"
)

func main() {
	client := postmark.NewClient("[SERVER-TOKEN]", "[ACCOUNT-TOKEN]")

	email := postmark.Email{
		From:       "[email protected]",
		To:         "[email protected]",
		Subject:    "Reset your password",
		HTMLBody:   "...",
		TextBody:   "...",
		Tag:        "pw-reset",
		TrackOpens: true,
	}

	_, err := client.SendEmail(context.Background(), email)
	if err != nil {
		panic(err)
	}
}

πŸ“š Documentation

View the generated documentation

Heads up! postmark is intentionally light on dependencies. The only external package it uses is the excellent testify suiteβ€”and that's just for our tests. You can drop this library into your projects without dragging along extra baggage.


Supported API Coverage
Custom HTTPClient Support
package main

import (
    "github.com/mrz1836/postmark"
    "google.golang.org/appengine"
    "google.golang.org/appengine/urlfetch"
)

// ....

client := postmark.NewClient("[SERVER-TOKEN]", "[ACCOUNT-TOKEN]")

ctx := appengine.NewContext(req)
client.HTTPClient = urlfetch.Client(ctx)

// ...
Development Setup (Getting Started)

Install MAGE-X build tool for development:

# Install MAGE-X for development and building
go install github.com/mrz1836/mage-x/cmd/magex@latest
magex update:install
Library Deployment

This project uses goreleaser for streamlined binary and library deployment to GitHub. To get started, install it via:

brew install goreleaser

The release process is defined in the .goreleaser.yml configuration file.

Then create and push a new Git tag using:

magex version:bump bump=patch push=true branch=master

This process ensures consistent, repeatable releases with properly versioned artifacts and citation metadata.

Build Commands

View all build commands

magex help
GitHub Workflows

All workflows are driven by modular configuration in .github/env/ β€” no YAML editing required.

View all workflows and the control center β†’

Updating Dependencies

To update all dependencies (Go modules, linters, and related tools), run:

magex deps:update

This command ensures all dependencies are brought up to date in a single step, including Go modules and any managed tools. It is the recommended way to keep your development environment and CI in sync with the latest versions.


Examples & Tests

πŸ§ͺ Examples & Tests

All unit tests and fuzz tests run via GitHub Actions and use Go version 1.18.x. View the configuration file.

Run all tests (fast):

magex test

Run all tests with race detector (slower):

magex test:race

⚑ Benchmarks

Run the Go benchmarks:

magex bench
πŸ“Š Performance Results

All benchmarks measure real API client performance including HTTP request setup, JSON marshaling/unmarshalling, and response processing against mock servers. Results collected on Apple M1 Max (10 cores).

🎯 Performance Overview
Metric Value Description
Fastest Operation 36.7 Β΅s Get Bounced Tags
Average Latency 41.2 Β΅s Across all 47 operations
Throughput ~24,000 ops/sec Per operation average
Memory Efficiency 7.7 KB/op Average memory usage
Allocations 97 allocs/op Average per operation
Bounce API Performance
Operation Latency (Β΅s) Throughput (ops/sec) Memory Allocs
Get Delivery Stats 38.0 26,300 6.8 KB 86
Get Bounces 41.6 24,000 7.8 KB 110
Get Bounce 40.4 24,800 7.1 KB 89
Get Bounce Dump 37.4 26,700 6.6 KB 84
Activate Bounce 39.9 25,100 7.2 KB 92
Get Bounced Tags 36.7 27,200 6.6 KB 85
Data Removal API Performance
Operation Latency (Β΅s) Throughput (ops/sec) Memory Allocs
Create Data Removal 41.5 24,100 7.6 KB 100
Get Data Removal Status 38.6 25,900 6.8 KB 86
Domains API Performance
Operation Latency (Β΅s) Throughput (ops/sec) Memory Allocs
Get Domains 40.2 24,900 7.2 KB 101
Get Domain 41.9 23,900 7.3 KB 89
Create Domain 41.3 24,200 7.8 KB 100
Edit Domain 41.7 24,000 8.3 KB 107
Delete Domain 38.2 26,200 7.1 KB 89
Verify DKIM Status 39.6 25,200 7.4 KB 91
Verify Return Path 39.2 25,500 7.4 KB 90
Rotate DKIM 40.2 24,900 7.6 KB 93
Inbound Rules Triggers API Performance
Operation Latency (Β΅s) Throughput (ops/sec) Memory Allocs
Get Inbound Rule Triggers 39.8 25,100 7.1 KB 101
Create Inbound Rule Trigger 41.0 24,400 7.6 KB 99
Delete Inbound Rule Trigger 40.4 24,700 6.7 KB 84
Message Streams API Performance
Operation Latency (Β΅s) Throughput (ops/sec) Memory Allocs
List Message Streams 44.4 22,500 7.4 KB 93
Get Message Stream 42.6 23,500 7.0 KB 89
Edit Message Stream 46.8 21,400 8.1 KB 106
Create Message Stream 44.5 22,500 8.1 KB 104
Archive Message Stream 40.4 24,800 6.8 KB 86
Unarchive Message Stream 42.6 23,500 7.1 KB 90
Messages API Performance
Operation Latency (Β΅s) Throughput (ops/sec) Memory Allocs
Get Outbound Messages Clicks 47.5 21,100 8.5 KB 118
Get Outbound Message Clicks 43.2 23,100 7.9 KB 109
Sender Signatures API Performance
Operation Latency (Β΅s) Throughput (ops/sec) Memory Allocs
Get Sender Signatures 40.6 24,600 7.3 KB 104
Get Sender Signature 40.6 24,600 7.5 KB 92
Create Sender Signature 42.2 23,700 8.1 KB 101
Edit Sender Signature 47.1 21,200 8.6 KB 108
Delete Sender Signature 38.8 25,800 7.1 KB 89
Resend Signature Confirmation 39.0 25,700 7.2 KB 90
Stats API Performance
Operation Latency (Β΅s) Throughput (ops/sec) Memory Allocs
Get Click Counts 40.3 24,800 7.4 KB 103
Get Browser Family Counts 42.2 23,700 7.6 KB 103
Get Click Location Counts 42.8 23,400 7.4 KB 103
Get Click Platform Counts 42.0 23,800 7.5 KB 103
Get Email Client Counts 41.3 24,200 7.6 KB 103
Templates API Performance
Operation Latency (Β΅s) Throughput (ops/sec) Memory Allocs
Get Template 39.9 25,100 7.5 KB 92
Get Templates 41.3 24,200 7.5 KB 103
Get Templates Filtered 40.0 25,000 7.4 KB 103
Create Template 44.7 22,400 7.9 KB 99
Edit Template 42.5 23,500 8.4 KB 106
Delete Template 39.3 25,500 7.1 KB 89
Validate Template 44.9 22,300 8.5 KB 110
Send Templated Email 44.2 22,600 8.8 KB 110
Send Templated Email Batch 46.1 21,700 9.0 KB 117
Push Templates 42.9 23,300 7.9 KB 105

Note: All benchmarks use mock HTTP servers for consistent, reproducible measurements. Real-world performance will vary based on network latency and Postmark API response times.


πŸ› οΈ Code Standards

Read more about this Go project's code standards.


πŸ€– AI Usage & Assistant Guidelines

Read the AI Usage & Assistant Guidelines for details on how AI is used in this project and how to interact with the AI assistants.


πŸ‘₯ Maintainers

MrZ
MrZ

🀝 Contributing

View the contributing guidelines and please follow the code of conduct.

How can I help?

All kinds of contributions are welcome πŸ™Œ! The most basic way to show your support is to star 🌟 the project, or to raise issues πŸ’¬. You can also support this project by becoming a sponsor on GitHub πŸ‘ or by making a bitcoin donation to ensure this journey continues indefinitely! πŸš€

Stars


πŸ“ License

License

Documentation ΒΆ

Overview ΒΆ

Package postmark encapsulates the Postmark API via Go

Index ΒΆ

Constants ΒΆ

View Source
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"
)
View Source
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 ΒΆ

View Source
var ErrEmailFailed = errors.New("email send failed")

ErrEmailFailed is returned when email sending fails

View Source
var ErrHeaderInjection = errors.New("header injection detected: illegal characters in template alias")

ErrHeaderInjection is returned when header injection is detected

Functions ΒΆ

func GetPathParam ΒΆ added in v1.8.0

func GetPathParam(r *http.Request, key string) string

GetPathParam extracts a path parameter from the request context. This is only available for handlers registered with parameterized routes.

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

func (APIError) Error ΒΆ

func (res APIError) Error() string

Error returns the error message details

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 {
	// RecordType: Type of record (bounce)
	RecordType string
	// 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
	// MessageStream: Message stream ID
	MessageStream 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
	// Content: Raw email content
	Content 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 BrowserFamilyCounts ΒΆ added in v1.8.0

type BrowserFamilyCounts struct {
	// Days - List of objects that each represent browser family usage by date.
	Days []BrowserFamilyDay
	// Chrome - total number of clicks from Chrome browser
	Chrome int64
	// Safari - total number of clicks from Safari browser
	Safari int64
	// Firefox - total number of clicks from Firefox browser
	Firefox int64
	// InternetExplorer - total number of clicks from Internet Explorer browser
	InternetExplorer int64
	// Opera - total number of clicks from Opera browser
	Opera int64
	// Unknown - total number of clicks from unknown browsers
	Unknown int64
}

BrowserFamilyCounts - browser family usage stats for a period

type BrowserFamilyDay ΒΆ added in v1.8.0

type BrowserFamilyDay struct {
	// Date - self-explanatory
	Date string
	// Chrome - number of clicks from Chrome browser
	Chrome int64
	// Safari - number of clicks from Safari browser
	Safari int64
	// Firefox - number of clicks from Firefox browser
	Firefox int64
	// InternetExplorer - number of clicks from Internet Explorer browser
	InternetExplorer int64
	// Opera - number of clicks from Opera browser
	Opera int64
	// Unknown - number of clicks from unknown browsers
	Unknown int64
}

BrowserFamilyDay - browser family usage stats for a specific day

type Click ΒΆ added in v1.8.0

type Click struct {
	// RecordType - Record type
	RecordType string
	// ClickLocation - Where link was clicked (e.g., "HTML")
	ClickLocation string
	// Client - Shows the email client (or browser) used to click the link.
	Client map[string]string
	// OS - Shows the operating system used to click the link.
	OS map[string]string
	// Platform - Shows what platform was used to click the link.
	Platform string
	// UserAgent - Full user-agent header passed by the client software to Postmark.
	UserAgent string
	// OriginalLink - The original link that was clicked.
	OriginalLink string
	// Geo - Contains IP of the recipient's machine where the link was clicked and the information based on that IP - geo coordinates and country, region, city and zip.
	Geo map[string]string
	// MessageID - Unique ID of the message.
	MessageID string
	// MessageStream - Message stream the click originated from.
	MessageStream string
	// ReceivedAt - Timestamp when the click occurred.
	ReceivedAt time.Time
	// Tag - Tag associated with the message.
	Tag string
	// Recipient - Email address of the recipient who clicked.
	Recipient string
}

Click represents a single email click.

type ClickCounts ΒΆ added in v1.8.0

type ClickCounts struct {
	// Days - List of objects that each represent click counts by date.
	Days []ClickDay
	// Clicks - Indicates total number of clicks. This total includes recipients who clicked your links multiple times.
	Clicks int64
	// Unique - Indicates total number of uniquely clicked links.
	Unique int64
}

ClickCounts - click stats for a period

type ClickDay ΒΆ added in v1.8.0

type ClickDay struct {
	// Date - self-explanatory
	Date string
	// Clicks - number of total clicks
	Clicks int64
	// Unique - number of unique clicks
	Unique int64
}

ClickDay - click stats for a specific day

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 ClickLocationCounts ΒΆ added in v1.8.0

type ClickLocationCounts struct {
	// Days - List of objects that each represent click location counts by date.
	Days []ClickLocationDay
	// HTML - total number of clicks from HTML part of the email
	HTML int64
	// Text - total number of clicks from text part of the email
	Text int64
}

ClickLocationCounts - click location stats for a period

type ClickLocationDay ΒΆ added in v1.8.0

type ClickLocationDay struct {
	// Date - self-explanatory
	Date string
	// HTML - number of clicks from HTML part of the email
	HTML int64
	// Text - number of clicks from text part of the email
	Text int64
}

ClickLocationDay - click location stats for a specific day

type ClickPlatformCounts ΒΆ added in v1.8.0

type ClickPlatformCounts struct {
	// Days - List of objects that each represent click platform usage by date.
	Days []ClickPlatformDay
	// Desktop - total number of clicks from Desktop platforms
	Desktop int64
	// Mobile - total number of clicks from Mobile platforms
	Mobile int64
	// Unknown - total number of clicks from unknown platforms
	Unknown int64
	// WebMail - total number of clicks from WebMail platforms
	WebMail int64
}

ClickPlatformCounts - click platform usage stats for a period

type ClickPlatformDay ΒΆ added in v1.8.0

type ClickPlatformDay struct {
	// Date - self-explanatory
	Date string
	// Desktop - number of clicks from Desktop platforms
	Desktop int64
	// Mobile - number of clicks from Mobile platforms
	Mobile int64
	// Unknown - number of clicks from unknown platforms
	Unknown int64
	// WebMail - number of clicks from WebMail platforms
	WebMail int64
}

ClickPlatformDay - click platform usage stats for a specific day

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 ΒΆ

func NewClient(serverToken, accountToken string) *Client

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 ΒΆ

func (client *Client) ActivateBounce(ctx context.Context, bounceID int64) (Bounce, string, error)

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 ΒΆ

func (client *Client) BypassInboundMessage(ctx context.Context, messageID string) error

BypassInboundMessage - Bypass rules for a blocked inbound message

func (*Client) CreateDataRemoval ΒΆ added in v1.8.0

func (client *Client) CreateDataRemoval(ctx context.Context, request DataRemovalRequest) (DataRemovalResponse, error)

CreateDataRemoval creates a new data removal request

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) CreateInboundRuleTrigger ΒΆ added in v1.8.0

func (client *Client) CreateInboundRuleTrigger(ctx context.Context, rule string) (InboundRuleTrigger, error)

CreateInboundRuleTrigger creates an inbound rule trigger to block emails

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 ΒΆ

func (client *Client) CreateTemplate(ctx context.Context, template Template) (TemplateInfo, error)

CreateTemplate saves a new template to the server

func (*Client) CreateWebhook ΒΆ added in v1.5.0

func (client *Client) CreateWebhook(ctx context.Context, webhook Webhook) (Webhook, error)

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

func (client *Client) DeleteDomain(ctx context.Context, domainID int64) error

DeleteDomain deletes a specific domain via domainID

func (*Client) DeleteInboundRuleTrigger ΒΆ added in v1.8.0

func (client *Client) DeleteInboundRuleTrigger(ctx context.Context, triggerID int64) error

DeleteInboundRuleTrigger deletes an inbound rule trigger by ID

func (*Client) DeleteSenderSignature ΒΆ added in v1.7.0

func (client *Client) DeleteSenderSignature(ctx context.Context, signatureID int64) error

DeleteSenderSignature removes a sender from the server.

func (*Client) DeleteServer ΒΆ added in v1.7.0

func (client *Client) DeleteServer(ctx context.Context, serverID int64) error

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 ΒΆ

func (client *Client) DeleteTemplate(ctx context.Context, templateID string) error

DeleteTemplate removes a template (with templateID) from the server

func (*Client) DeleteWebhook ΒΆ added in v1.5.0

func (client *Client) DeleteWebhook(ctx context.Context, id int) error

DeleteWebhook removes a webhook from the server.

func (*Client) EditCurrentServer ΒΆ

func (client *Client) EditCurrentServer(ctx context.Context, server Server) (Server, error)

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

func (client *Client) EditWebhook(ctx context.Context, id int, webhook Webhook) (Webhook, error)

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) GetBounce ΒΆ

func (client *Client) GetBounce(ctx context.Context, bounceID int64) (Bounce, error)

GetBounce fetches a single bounce with bounceID

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 ΒΆ

func (client *Client) GetBounceDump(ctx context.Context, bounceID int64) (string, error)

GetBounceDump fetches an SMTP data dump for a single bounce

func (*Client) GetBouncedTags ΒΆ

func (client *Client) GetBouncedTags(ctx context.Context) ([]string, error)

GetBouncedTags retrieves a list of tags that have generated bounced emails

func (*Client) GetBounces ΒΆ

func (client *Client) GetBounces(ctx context.Context, count, 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) GetBrowserFamilyCounts ΒΆ added in v1.8.0

func (client *Client) GetBrowserFamilyCounts(ctx context.Context, options map[string]interface{}) (BrowserFamilyCounts, error)

GetBrowserFamilyCounts - Gets total counts of clicks by browser family. This is only recorded when link tracking is enabled for that email. Available options: http://developer.postmarkapp.com/developer-api-stats.html#browser-usage

func (*Client) GetClickCounts ΒΆ added in v1.8.0

func (client *Client) GetClickCounts(ctx context.Context, options map[string]interface{}) (ClickCounts, error)

GetClickCounts - Gets total counts of recipients who clicked links in your emails. This is only recorded when link tracking is enabled for that email. Available options: http://developer.postmarkapp.com/developer-api-stats.html#click-counts

func (*Client) GetClickLocationCounts ΒΆ added in v1.8.0

func (client *Client) GetClickLocationCounts(ctx context.Context, options map[string]interface{}) (ClickLocationCounts, error)

GetClickLocationCounts - Gets total counts of clicks by email format. This is only recorded when link tracking is enabled for that email. Available options: http://developer.postmarkapp.com/developer-api-stats.html#click-location

func (*Client) GetClickPlatformCounts ΒΆ added in v1.8.0

func (client *Client) GetClickPlatformCounts(ctx context.Context, options map[string]interface{}) (ClickPlatformCounts, error)

GetClickPlatformCounts - Gets total counts of clicks by platform. This is only recorded when link tracking is enabled for that email. Available options: http://developer.postmarkapp.com/developer-api-stats.html#browser-platform-usage

func (*Client) GetCurrentServer ΒΆ

func (client *Client) GetCurrentServer(ctx context.Context) (Server, error)

GetCurrentServer gets details for the server associated with the currently in-use server API Key

func (*Client) GetDataRemovalStatus ΒΆ added in v1.8.0

func (client *Client) GetDataRemovalStatus(ctx context.Context, id int64) (DataRemovalResponse, error)

GetDataRemovalStatus checks the status of a data removal request

func (*Client) GetDeliveryStats ΒΆ

func (client *Client) GetDeliveryStats(ctx context.Context) (DeliveryStats, error)

GetDeliveryStats returns delivery stats for the server

func (*Client) GetDomain ΒΆ added in v1.7.0

func (client *Client) GetDomain(ctx context.Context, domainID int64) (DomainDetails, error)

GetDomain fetches a specific domain via domainID

func (*Client) GetDomains ΒΆ added in v1.7.0

func (client *Client) GetDomains(ctx context.Context, count, offset int) (DomainsList, error)

GetDomains gets a list of domains, limited by count and paged by offset

func (*Client) GetEmailClientCounts ΒΆ added in v1.8.0

func (client *Client) GetEmailClientCounts(ctx context.Context, options map[string]interface{}) (EmailClientCounts, error)

GetEmailClientCounts - Gets total counts of opens by email client. This is only recorded when open tracking is enabled for that email. Available options: http://developer.postmarkapp.com/developer-api-stats.html#email-client-usage

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, 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) GetInboundRuleTriggers ΒΆ added in v1.8.0

func (client *Client) GetInboundRuleTriggers(ctx context.Context, count, offset int64) ([]InboundRuleTrigger, int64, error)

GetInboundRuleTriggers fetches a list of inbound rule triggers on the server It returns a slice of InboundRuleTrigger, the total trigger count, and any error that occurred

func (*Client) GetMessageStream ΒΆ added in v1.6.0

func (client *Client) GetMessageStream(ctx context.Context, id string) (MessageStream, error)

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) GetOutboundMessageClicks ΒΆ added in v1.8.0

func (client *Client) GetOutboundMessageClicks(ctx context.Context, messageID string, count, offset int64) ([]Click, int64, error)

GetOutboundMessageClicks fetches a list of clicks for a specific message It returns a Click slice, the total clicks count, and any error that occurred

func (*Client) GetOutboundMessageDump ΒΆ

func (client *Client) GetOutboundMessageDump(ctx context.Context, messageID string) (string, error)

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, 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, 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 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) GetOutboundMessagesClicks ΒΆ added in v1.8.0

func (client *Client) GetOutboundMessagesClicks(ctx context.Context, count, offset int64, options map[string]interface{}) ([]Click, int64, error)

GetOutboundMessagesClicks fetches a list of clicks on the server It returns a Click slice, the total clicks count, and any error that occurred To get clicks for a specific message, use GetOutboundMessageClicks() Available options: http://developer.postmarkapp.com/developer-api-messages.html#message-clicks

func (*Client) GetOutboundMessagesOpens ΒΆ

func (client *Client) GetOutboundMessagesOpens(ctx context.Context, count, 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) GetServer ΒΆ

func (client *Client) GetServer(ctx context.Context, serverID int64) (Server, error)

GetServer fetches a specific server via serverID

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 ΒΆ

func (client *Client) GetTemplate(ctx context.Context, templateID string) (Template, error)

GetTemplate fetches a specific template via TemplateID

func (*Client) GetTemplates ΒΆ

func (client *Client) GetTemplates(ctx context.Context, count, 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 TemplateInfo only returns a subset of template attributes, use GetTemplate(id) to retrieve all template info.

func (*Client) GetTemplatesFiltered ΒΆ added in v1.8.0

func (client *Client) GetTemplatesFiltered(ctx context.Context, count, offset int64, templateType, layoutTemplate string) ([]TemplateInfo, int64, error)

GetTemplatesFiltered fetches a filtered list of templates on the server templateType: filter by template type ("Standard", "Layout", or "" for all) layoutTemplate: filter by layout template alias (or "" for all)

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

func (client *Client) GetWebhook(ctx context.Context, id int) (Webhook, error)

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

func (client *Client) ListWebhooks(ctx context.Context, messageStream string) ([]Webhook, error)

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) PushTemplates ΒΆ added in v1.8.0

func (client *Client) PushTemplates(ctx context.Context, request PushTemplatesRequest) (PushTemplatesResponse, error)

PushTemplates pushes templates from one server to another

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 ΒΆ

func (client *Client) RetryInboundMessage(ctx context.Context, messageID string) error

RetryInboundMessage - Retry a failed inbound message for processing

func (*Client) RotateDKIM ΒΆ added in v1.7.0

func (client *Client) RotateDKIM(ctx context.Context, domainID int64) (DomainDetails, error)

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) SendEmail ΒΆ

func (client *Client) SendEmail(ctx context.Context, email Email) (EmailResponse, error)

SendEmail sends, well, an email.

func (*Client) SendEmailBatch ΒΆ

func (client *Client) SendEmailBatch(ctx context.Context, emails []Email) ([]EmailResponse, error)

SendEmailBatch sends multiple emails together 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

func (client *Client) UnarchiveMessageStream(ctx context.Context, id string) (MessageStream, error)

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

func (client *Client) VerifyDKIMStatus(ctx context.Context, domainID int64) (DomainDetails, error)

VerifyDKIMStatus verifies DKIM keys for the specified domain.

func (*Client) VerifyReturnPath ΒΆ added in v1.7.0

func (client *Client) VerifyReturnPath(ctx context.Context, domainID int64) (DomainDetails, error)

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 DataRemovalRequest ΒΆ added in v1.8.0

type DataRemovalRequest struct {
	// Recipient: The email address of the recipient whose data should be removed
	Recipient string `json:"Recipient"`
}

DataRemovalRequest represents a request to remove recipient data from Postmark

type DataRemovalResponse ΒΆ added in v1.8.0

type DataRemovalResponse struct {
	// ID: Unique ID of the data removal request
	ID int64 `json:"ID"`
	// Recipient: Email address of the recipient whose data is being removed
	Recipient string `json:"Recipient"`
	// RequestedAt: Timestamp when the removal was requested
	RequestedAt time.Time `json:"RequestedAt"`
	// Status: Current status of the removal (Pending, Processing, Completed, Failed)
	Status string `json:"Status"`
	// CompletedAt: Timestamp when the removal was completed (if applicable)
	CompletedAt *time.Time `json:"CompletedAt,omitempty"`
}

DataRemovalResponse represents the response from a data removal request

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

type DomainsList struct {
	TotalCount int
	Domains    []Domain
}

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"`
	// InlineCSS: By default, if the HTML body contains CSS, we will apply the style blocks as inline attributes. Set to false to opt out.
	InlineCSS bool `json:",omitempty"`
}

Email is exactly what it sounds like

type EmailClientCounts ΒΆ added in v1.8.0

type EmailClientCounts struct {
	// Days - List of objects that each represent email client usage by date.
	Days []EmailClientDay
	// Outlook - total number of opens from Outlook email client
	Outlook int64
	// Gmail - total number of opens from Gmail email client
	Gmail int64
	// AppleMail - total number of opens from Apple Mail email client
	AppleMail int64
	// Thunderbird - total number of opens from Thunderbird email client
	Thunderbird int64
	// Yahoo - total number of opens from Yahoo email client
	Yahoo int64
	// Unknown - total number of opens from unknown email clients
	Unknown int64
}

EmailClientCounts - email client usage stats for a period

type EmailClientDay ΒΆ added in v1.8.0

type EmailClientDay struct {
	// Date - self-explanatory
	Date string
	// Outlook - number of opens from Outlook email client
	Outlook int64
	// Gmail - number of opens from Gmail email client
	Gmail int64
	// AppleMail - number of opens from Apple Mail email client
	AppleMail int64
	// Thunderbird - number of opens from Thunderbird email client
	Thunderbird int64
	// Yahoo - number of opens from Yahoo email client
	Yahoo int64
	// Unknown - number of opens from unknown email clients
	Unknown int64
}

EmailClientDay - email client usage stats for a specific day

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 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

func (InboundMessage) Time ΒΆ

func (x InboundMessage) Time() (time.Time, error)

Time returns a parsed time.Time struct

type InboundRuleTrigger ΒΆ added in v1.8.0

type InboundRuleTrigger struct {
	// ID: Unique ID of the trigger
	ID int64
	// Rule: Email address or domain to block
	Rule string
}

InboundRuleTrigger represents an inbound rule trigger

type InboundRuleTriggerCreateRequest ΒΆ added in v1.8.0

type InboundRuleTriggerCreateRequest struct {
	// Rule: Email address or domain to block (required)
	Rule string `json:"Rule"`
}

InboundRuleTriggerCreateRequest represents the request to create an inbound rule trigger

type InboundRulesTriggersResponse ΒΆ added in v1.8.0

type InboundRulesTriggersResponse struct {
	// TotalCount: Total matching triggers
	TotalCount int64
	// InboundRules: List of inbound rules
	InboundRules []InboundRuleTrigger
}

InboundRulesTriggersResponse represents the response from listing inbound rule triggers

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 OriginType ΒΆ added in v1.4.0

type OriginType string

OriginType - The reason type of origin

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 PushTemplatesRequest ΒΆ added in v1.8.0

type PushTemplatesRequest struct {
	// SourceServerID: ID of the server to push templates from
	SourceServerID int64 `json:"SourceServerId"`
	// DestinationServerID: ID of the server to push templates to
	DestinationServerID int64 `json:"DestinationServerId"`
	// PerformChanges: Whether to actually perform the push (true) or just simulate it (false)
	PerformChanges bool `json:",omitempty"`
}

PushTemplatesRequest contains the request data for pushing templates between servers

type PushTemplatesResponse ΒΆ added in v1.8.0

type PushTemplatesResponse struct {
	// TotalCount: Total number of templates processed
	TotalCount int64
	// Templates: Details of each template that was processed
	Templates []PushedTemplate
}

PushTemplatesResponse contains the results of pushing templates between servers

type PushedTemplate ΒΆ added in v1.8.0

type PushedTemplate struct {
	// TemplateID: ID of the template
	TemplateID int64 `json:"TemplateId"`
	// Name: Name of the template
	Name string
	// Alias: Alias of the template (if any)
	Alias string
	// Action: Action performed (Created, Updated, Skipped, etc.)
	Action string
}

PushedTemplate represents a template that was pushed between servers

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"` //nolint:gosec // G117: field is part of Postmark API response struct
	// 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

func (s Server) MarshalJSON() ([]byte, error)

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

type ServersList struct {
	TotalCount int
	Servers    []Server
}

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
	// Alias: Optional alias for the template.
	Alias string `json:",omitempty"`
	// TemplateType: Type of template (Standard or Layout)
	TemplateType string `json:",omitempty"`
	// LayoutTemplate: Layout template alias if using a layout
	LayoutTemplate string `json:",omitempty"`
}

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
	// Alias: Optional alias for the template.
	Alias string `json:",omitempty"`
	// TemplateType: Type of template (Standard or Layout)
	TemplateType string `json:",omitempty"`
	// LayoutTemplate: Layout template alias if using a layout
	LayoutTemplate string `json:",omitempty"`
}

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]string `json:",omitempty"`
}

TemplatedEmail is used to send an email via a template

type TestRouter ΒΆ added in v1.8.0

type TestRouter struct {
	// contains filtered or unexported fields
}

TestRouter provides simple HTTP routing for testing purposes. It supports method-based routing and path parameter extraction.

func NewTestRouter ΒΆ added in v1.8.0

func NewTestRouter() *TestRouter

NewTestRouter creates a new test router.

func (*TestRouter) Delete ΒΆ added in v1.8.0

func (tr *TestRouter) Delete(pattern string, handler http.HandlerFunc)

Delete registers a DELETE handler for the given pattern.

func (*TestRouter) Get ΒΆ added in v1.8.0

func (tr *TestRouter) Get(pattern string, handler http.HandlerFunc)

Get registers a GET handler for the given pattern.

func (*TestRouter) HandleFunc ΒΆ added in v1.8.0

func (tr *TestRouter) HandleFunc(method, pattern string, handler http.HandlerFunc)

HandleFunc registers a handler function for the given method and pattern.

func (*TestRouter) Patch ΒΆ added in v1.8.0

func (tr *TestRouter) Patch(pattern string, handler http.HandlerFunc)

Patch registers a PATCH handler for the given pattern.

func (*TestRouter) Post ΒΆ added in v1.8.0

func (tr *TestRouter) Post(pattern string, handler http.HandlerFunc)

Post registers a POST handler for the given pattern.

func (*TestRouter) Put ΒΆ added in v1.8.0

func (tr *TestRouter) Put(pattern string, handler http.HandlerFunc)

Put registers a PUT handler for the given pattern.

func (*TestRouter) ServeHTTP ΒΆ added in v1.8.0

func (tr *TestRouter) ServeHTTP(w http.ResponseWriter, req *http.Request)

ServeHTTP implements http.Handler interface.

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 ΒΆ

type ValidationError struct {
	Message           string
	Line              int
	CharacterPosition int
}

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"` //nolint:gosec // G117: field is part of webhook HTTP auth configuration
}

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.

Directories ΒΆ

Path Synopsis
Package main is an example of how to use the Postmark Go client.
Package main is an example of how to use the Postmark Go client.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL