email

package
v0.0.0-...-834dad9 Latest Latest
Warning

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

Go to latest
Published: Jan 26, 2024 License: Apache-2.0 Imports: 7 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var ErrMailNotConfigured = errors.New("mailer not configured")

ErrUnknownDriver is returned when the driver is not registered

View Source
var ErrUnknownDriver = fmt.Errorf("unknown driver")

ErrUnknownDriver is returned when the driver is not registered

Functions

This section is empty.

Types

type Config

type Config = mail.Config

Config for mailer

type Mailer

type Mailer = mail.Mailer

Mailer is the interface that wraps the basic Send method

type Option

type Option func(*Options)

Option for email sender

func WithConfig

func WithConfig(driver string, cfg *Config) Option

WithConfig sets mailer config

func WithHeaders

func WithHeaders(headers map[string]string) Option

WithHeaders sets default headers

func WithMailer

func WithMailer(mailer Mailer) Option

WithMailer sets mailer

func WithVars

func WithVars(vars map[string]any) Option

WithVars sets default vars

type Options

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

Options for email sender

func (*Options) Mailer

func (o *Options) Mailer() (mail.Mailer, error)

Mailer returns mailer

type Sender

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

Sender implements sendmsg.Sender interface for email

func New

func New(opts ...Option) (*Sender, error)

New creates new email sender

func (*Sender) Send

func (s *Sender) Send(ctx context.Context, message sendmsg.Message) error

Send sends message to the target

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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