postmark

package module
v0.0.0-...-f147096 Latest Latest
Warning

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

Go to latest
Published: Feb 17, 2021 License: GPL-3.0 Imports: 6 Imported by: 0

README

postmark

Postmark client written in Go.

Documentation

Index

Constants

View Source
const (
	PostmarkAPI               = "https://api.postmarkapp.com"
	EndpointEmail             = PostmarkAPI + "/email"
	EndpointEmailWithTemplate = PostmarkAPI + "/email/withTemplate"
	EndpointBatch             = PostmarkAPI + "/email/batch"
	EndpointBatchWithTemplate = PostmarkAPI + "/email/batchWithTemplates"
)

Variables

This section is empty.

Functions

func WithContext

func WithContext(ctx context.Context, sender Sender) context.Context

WithContext ...

Types

type Email

type Email struct {
	From          string
	To            string
	MessageStream string
	Tag           string            `json:",omitempty"`
	Headers       map[string]string `json:",omitempty"`

	// Content
	Subject  string `json:",omitempty"`
	TextBody string `json:",omitempty"`
	HTMLBody string `json:"HtmlBody"`

	// Template
	TemplateID    uint                   `json:",omitempty"`
	TemplateAlias string                 `json:",omitempty"`
	TemplateModel map[string]interface{} `json:",omitempty"`
	InlineCSS     bool
}

Email ...

func (Email) MarshalJSON

func (e Email) MarshalJSON() ([]byte, error)

MarshalJSON ...

func (Email) UsesTemplate

func (e Email) UsesTemplate() bool

UsesTemplate ...

type NopSender

type NopSender struct{}

NopSender ...

func (NopSender) Send

func (NopSender) Send(_ context.Context, _ Email) (Response, error)

func (NopSender) SendBatch

func (NopSender) SendBatch(_ context.Context, _ ...Email) ([]Response, error)

type Response

type Response struct {
	To          string
	SubmittedAt time.Time
	MessageID   string
	ErrorCode   int
	Message     string
}

Response ...

func Send

func Send(ctx context.Context, email Email) (Response, error)

Send ...

func SendBatch

func SendBatch(ctx context.Context, emails ...Email) ([]Response, error)

SendBatch ...

type Sender

type Sender interface {
	Send(context.Context, Email) (Response, error)
	SendBatch(context.Context, ...Email) ([]Response, error)
}

Sender ...

func GetSender

func GetSender(ctx context.Context) Sender

GetSender ...

type Server

type Server struct {
	Token string
}

Server ...

func (*Server) Send

func (s *Server) Send(ctx context.Context, email Email) (Response, error)

Send ...

func (*Server) SendBatch

func (s *Server) SendBatch(ctx context.Context, emails ...Email) ([]Response, error)

SendBatch ...

Jump to

Keyboard shortcuts

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