postmark

package
v0.2.1 Latest Latest
Warning

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

Go to latest
Published: Feb 23, 2024 License: Apache-2.0 Imports: 6 Imported by: 1

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	ErrFailedToSendEmail    = errors.New("failed to send email")
	ErrMissingFromEmail     = errors.New("missing from email address")
	ErrFailedToCreateClient = errors.New("failed to create client")
	ErrMissingCredentials   = errors.New("missing server or account token")
)

Predefined postmark adapter errors.

Functions

This section is empty.

Types

type Client

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

Postmark service wrapper

func New

func New(serverToken, accountToken string, conf Config) (*Client, error)

New func is a factory function, returns a new instance of the Client interface implementation

func (*Client) SendEmail

func (c *Client) SendEmail(ctx context.Context, payload mailer.SendEmailPayload) error

SendEmail sends an email. It returns an error if sending fails. SendEmail sends an email using the Postmark client. It takes a context and a SendEmailPayload as input. The SendEmailPayload contains the necessary information for the email, such as the recipient, subject, body, and attachments. The function returns an error if the email fails to send.

type Config

type Config struct {
	// From is the email address to use for the from header. This must be a verified sender signature.
	From string
	// ReplyTo is the email address to use for the reply-to header.
	ReplyTo string
	// TrackOpens is a boolean indicating if you want to track opens.
	TrackOpens bool
	// TrackLinks is a boolean indicating if you want to track links.
	TrackLinks bool
}

Config struct

func (Config) Validate

func (c Config) Validate() error

Validate the config

Jump to

Keyboard shortcuts

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