postmark

package
v1.3.1 Latest Latest
Warning

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

Go to latest
Published: Nov 3, 2026 License: AGPL-3.0 Imports: 20 Imported by: 0

Documentation

Overview

Package postmark is the Postmark adapter. Postmark's terms allow bulk mail only on a Broadcast message stream, which the adapter can create.

Index

Constants

View Source
const Adapter = "postmark"

Adapter is the registry key.

View Source
const BatchSize = 500

BatchSize is Postmark's batch limit.

View Source
const DefaultBaseURL = "https://api.postmarkapp.com"

DefaultBaseURL is Postmark's API.

View Source
const MetaMessage = "rc_message"

MetaMessage is the metadata key carrying the ReputeCast message id.

View Source
const WebhookUser = "reputecast"

WebhookUser is the basic-auth user name ReputeCast registers on webhooks; the password is the provider's webhook secret.

Variables

This section is empty.

Functions

func Descriptor

func Descriptor() providers.Descriptor

Descriptor describes the adapter for the catalog.

func New

New builds the adapter from a connected provider's configuration.

Types

type Credentials

type Credentials struct {
	ServerToken  string `json:"server_token"`
	AccountToken string `json:"account_token,omitempty"`
}

Credentials are write-only.

type Provider

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

Provider talks to one Postmark server.

func (*Provider) Adapter

func (p *Provider) Adapter() string

Adapter implements providers.Provider.

func (*Provider) AddDomain

func (p *Provider) AddDomain(ctx context.Context, domain string) ([]providers.DNSRecord, error)

AddDomain implements providers.DomainManager (needs the account token).

func (*Provider) AddSuppressions

func (p *Provider) AddSuppressions(ctx context.Context, emails []string) error

AddSuppressions implements providers.SuppressionSyncer (50 per request).

func (*Provider) Capabilities

func (p *Provider) Capabilities() providers.Capabilities

Capabilities implements providers.Provider.

func (*Provider) CreateBroadcastStream

func (p *Provider) CreateBroadcastStream(ctx context.Context, name string) (string, error)

CreateBroadcastStream implements providers.BroadcastStreamCreator.

func (*Provider) DisableTracking

func (p *Provider) DisableTracking(ctx context.Context) error

DisableTracking implements providers.TrackingManager.

func (*Provider) DomainStatus

func (p *Provider) DomainStatus(ctx context.Context, domain string) ([]providers.DNSRecord, error)

DomainStatus implements providers.DomainManager.

func (*Provider) InspectWebhook

func (p *Provider) InspectWebhook(ctx context.Context, hookURL string) (providers.WebhookStatus, error)

InspectWebhook implements providers.WebhookInspector.

func (*Provider) ListSuppressions

func (p *Provider) ListSuppressions(ctx context.Context, since time.Time) ([]providers.Suppression, error)

ListSuppressions implements providers.SuppressionSyncer for every stream ReputeCast uses on this server.

func (*Provider) ParseWebhook

func (p *Provider) ParseWebhook(ctx context.Context, r *http.Request, body []byte) ([]providers.Event, error)

ParseWebhook implements providers.Provider. Postmark posts one record per request.

func (*Provider) Quota

func (p *Provider) Quota(ctx context.Context) (providers.Quota, error)

Quota implements providers.QuotaReporter: emails sent this month on the server against the plan's monthly allowance.

func (*Provider) RegisterWebhook

func (p *Provider) RegisterWebhook(ctx context.Context, hookURL string) error

RegisterWebhook implements providers.WebhookRegistrar: one webhook per stream, with basic auth. An existing webhook for the same URL is updated.

func (*Provider) RemoveSuppressions

func (p *Provider) RemoveSuppressions(ctx context.Context, emails []string) error

RemoveSuppressions implements providers.SuppressionRemover: Postmark reactivates the addresses on every stream ReputeCast sends through (it keeps spam complaints, which can't be removed).

func (*Provider) Reputation

func (p *Provider) Reputation(ctx context.Context) (providers.Reputation, error)

Reputation implements providers.ReputationReporter: Postmark's own bounce and spam complaint rates over the last seven days, from its outbound stats.

func (*Provider) Send

func (p *Provider) Send(ctx context.Context, msgs []providers.Message) ([]providers.SendResult, error)

Send implements providers.Provider with POST /email/batch.

func (*Provider) SendWithExtras

func (p *Provider) SendWithExtras(ctx context.Context, msgs []providers.Message, extras []providers.MessageExtras) ([]providers.SendResult, error)

SendWithExtras implements providers.ExtrasSender: Cc, Bcc and attachments (transactional mail).

func (*Provider) StatusPageURL

func (p *Provider) StatusPageURL() (string, string)

StatusPageURL implements providers.StatusPage.

func (*Provider) StreamFor

func (p *Provider) StreamFor(s providers.Stream) string

StreamFor returns the Postmark message stream used for a ReputeCast stream.

func (*Provider) SuppressionScope

func (p *Provider) SuppressionScope() providers.SuppressionScope

SuppressionScope implements providers.SuppressionScoper: Postmark keeps a suppression list per message stream of the workspace's server.

func (*Provider) Tracking

func (p *Provider) Tracking(ctx context.Context) (providers.Tracking, error)

Tracking implements providers.TrackingManager from the server settings.

func (*Provider) UnregisterWebhook

func (p *Provider) UnregisterWebhook(ctx context.Context, hookURL string) error

UnregisterWebhook implements providers.WebhookUnregistrar with DELETE /webhooks/{ID} for each webhook pointing at hookURL, in every stream (https://postmarkapp.com/developer/api/webhooks-api#delete-a-webhook).

func (*Provider) Verify

func (p *Provider) Verify(ctx context.Context) (providers.Quota, error)

Verify implements providers.Verifier.

func (*Provider) VerifyWebhook

func (p *Provider) VerifyWebhook(_ context.Context, r *http.Request, _ []byte) error

VerifyWebhook checks the basic-auth credentials ReputeCast registered.

type Settings

type Settings struct {
	Server          string `json:"server,omitempty"`
	ServerID        int64  `json:"server_id,omitempty"`
	MessageStream   string `json:"message_stream,omitempty"`
	BroadcastStream string `json:"broadcast_stream,omitempty"`
	// MonthlyLimit is the plan's monthly allowance, entered at connect time.
	MonthlyLimit int64 `json:"monthly_limit,omitempty"`
	// BaseURL overrides the API (tests, regional proxies).
	BaseURL string `json:"base_url,omitempty"`
}

Settings are the non-secret connection settings.

Jump to

Keyboard shortcuts

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