sendmail

package
v0.0.0-...-8277694 Latest Latest
Warning

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

Go to latest
Published: May 8, 2022 License: MIT Imports: 10 Imported by: 0

Documentation

Overview

mail sender package

Index

Constants

This section is empty.

Variables

View Source
var ErrNoLocalMailDelivery = errors.New("no local mail store for user")

Functions

This section is empty.

Types

type Bouncer

type Bouncer func(string, string, string, error)

mail bounce handler paramters are (recipiant email address, from email address, the filepath of the message, network related error or nil for regular bounce)

type DeliverJob

type DeliverJob interface {
	// cancel delivery job
	Cancel()
	// wait for completion, return true if delivered otherwise false
	Wait() bool
	// run delivery
	Run()
}

func NewLocalDelivery

func NewLocalDelivery(st mailstore.Store, fpath string) DeliverJob

new local delivery job

type Dialer

type Dialer func(string, string) (net.Conn, error)

dialer function

type LocalDeliverJob

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

func (*LocalDeliverJob) Cancel

func (l *LocalDeliverJob) Cancel()

local delivery is not cancelable TODO: make this configurable

func (*LocalDeliverJob) Run

func (l *LocalDeliverJob) Run()

run local delivery

func (*LocalDeliverJob) Wait

func (l *LocalDeliverJob) Wait() bool

wait for completion

type Mailer

type Mailer struct {
	// get mail storage for local user
	Local mailstore.MailRouter
	// a dial function to obtain outbound smtp client
	Dial Dialer
	// number of times to try to deliver mail
	// 0 for unlimited
	Retries int
	// called if mail bounces or fails to deliver
	Bounce Bouncer
	// domain resolver function
	Resolve Resolver
	// delivery success hook, called with (recipiant email address, from email address)
	Success func(string, string)
	// contains filtered or unexported fields
}

mail delivery

func NewMailer

func NewMailer() *Mailer

create a new pooled mailer

func (*Mailer) Deliver

func (s *Mailer) Deliver(recip, from string, msg mailstore.Message) (d DeliverJob)

try delivering mail returns a DeliveryJob that can be cancelled

func (*Mailer) Quit

func (m *Mailer) Quit()

gracefully quit all polled connections and close down

type RemoteDeliverJob

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

job for delivering mail remotely

func (*RemoteDeliverJob) Cancel

func (d *RemoteDeliverJob) Cancel()

cancel delivery

func (*RemoteDeliverJob) Run

func (d *RemoteDeliverJob) Run()

run delivery

func (*RemoteDeliverJob) Wait

func (d *RemoteDeliverJob) Wait() bool

wait for completion

type Resolver

type Resolver func(string) (net.Addr, error)

domain name resolver function

Jump to

Keyboard shortcuts

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