mailer

package
v0.9.16 Latest Latest
Warning

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

Go to latest
Published: Feb 12, 2026 License: MIT Imports: 9 Imported by: 0

Documentation

Index

Constants

View Source
const (
	DefaultMaxConnections      = 10
	DefaultMaxIdle             = time.Minute
	DefaultSweepInterval       = time.Second * 70
	DefaultScalingFactor  uint = 2
	DefaultMaxRetries     int  = 3
)

Timing settings

View Source
const (
	DefaultHostname = "dv.net"
	DefaultIdentity = "localhost-client"
)

Variables

View Source
var (
	ErrNoAvailableConnections = errors.New("no available SMTP connections")
	ErrMaxConnectionsReached  = errors.New("pool maximum SMTP connections reached")
	ErrScalingDisabled        = errors.New("pool scaling is disabled")
	ErrShrinkThresholdReached = errors.New("pool shrink threshold reached. Default being 10")
	ErrPoolClosed             = errors.New("pool is closed")
)

Functions

This section is empty.

Types

type IPool

type IPool interface {
	Send(string, []string, io.Reader) error
}

type PoolOptions

type PoolOptions struct {
	Address       string        `json:"address"` // SMTP server address ex. being (smtp.example.com:1025)
	MaxConn       uint          `json:"max_conn"`
	Hostname      string        `json:"hostname"`
	SSL           bool          `json:"ssl"`
	Username      *string       `json:"username"`
	Password      *string       `json:"password"`
	Identity      string        `json:"identity"`
	Auth          *sasl.Client  `json:"auth"` // Used to authenticate clients to the server
	TLSConfig     *tls.Config   `json:"tls_config"`
	MaxIdle       time.Duration `json:"max_idle"`
	MaxRetries    int           `json:"max_retries"`
	SweepInterval time.Duration `json:"sweep_interval"` // Time interval to sweep idle connections
	Scaling       bool          `json:"scaling"`        // If true, pool will dynamically grow and shrink itself
	ScalingFactor uint          `json:"scaling_factor"` // Scaling factor for dynamic pool size
}

type SMTPPool

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

func NewSMTPPool

func NewSMTPPool(ctx context.Context, o *PoolOptions) (*SMTPPool, error)

func (*SMTPPool) Close

func (o *SMTPPool) Close() error

func (*SMTPPool) Send

func (o *SMTPPool) Send(from string, to []string, body io.Reader) error

Jump to

Keyboard shortcuts

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