mailer

package
Version: v0.11.0 Latest Latest
Warning

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

Go to latest
Published: Aug 28, 2020 License: MIT Imports: 10 Imported by: 25

Documentation

Index

Constants

This section is empty.

Variables

View Source
var MaxReconnectAttempts = 10

MaxReconnectAttempts is the maximum number of times we should reconnect to a server

Functions

This section is empty.

Types

type Dialer

type Dialer interface {
	Dial() (Sender, error)
}

Dialer dials to an SMTP server and returns the SendCloser

type ErrMaxConnectAttempts

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

ErrMaxConnectAttempts is thrown when the maximum number of reconnect attempts is reached.

func (*ErrMaxConnectAttempts) Error

func (e *ErrMaxConnectAttempts) Error() string

Error returns the wrapped error response

type Mail

type Mail interface {
	Backoff(reason error) error
	Error(err error) error
	Success() error
	Generate(msg *gomail.Message) error
	GetDialer() (Dialer, error)
}

Mail is an interface that handles the common operations for email messages

type MailWorker

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

MailWorker is the worker that receives slices of emails on a channel to send. It's assumed that every slice of emails received is meant to be sent to the same server.

func NewMailWorker

func NewMailWorker() *MailWorker

NewMailWorker returns an instance of MailWorker with the mail queue initialized.

func (*MailWorker) Queue

func (mw *MailWorker) Queue(ms []Mail)

Queue sends the provided mail to the internal queue for processing.

func (*MailWorker) Start

func (mw *MailWorker) Start(ctx context.Context)

Start launches the mail worker to begin listening on the Queue channel for new slices of Mail instances to process.

type Mailer

type Mailer interface {
	Start(ctx context.Context)
	Queue([]Mail)
}

Mailer is an interface that defines an object used to queue and send mailer.Mail instances.

type Sender

type Sender interface {
	Send(from string, to []string, msg io.WriterTo) error
	Close() error
	Reset() error
}

Sender exposes the common operations required for sending email.

Jump to

Keyboard shortcuts

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