bounce

package
v0.0.0-...-8357697 Latest Latest
Warning

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

Go to latest
Published: Apr 18, 2024 License: AGPL-3.0 Imports: 7 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Mailbox

type Mailbox interface {
	Scan(limit int, ch chan models.Bounce) error
}

Mailbox represents a POP/IMAP mailbox client that can scan messages and pass them to a given channel.

type Manager

type Manager struct {
	SES      *webhooks.SES
	Sendgrid *webhooks.Sendgrid
	Postmark *webhooks.Postmark
	// contains filtered or unexported fields
}

Manager handles e-mail bounces.

func New

func New(opt Opt, q *Queries, lo *log.Logger) (*Manager, error)

New returns a new instance of the bounce manager.

func (*Manager) Record

func (m *Manager) Record(b models.Bounce) error

Record records a new bounce event given the subscriber's email or UUID.

func (*Manager) Run

func (m *Manager) Run()

Run is a blocking function that listens for bounce events from webhooks and or mailboxes and executes them on the DB.

type Opt

type Opt struct {
	MailboxEnabled  bool        `json:"mailbox_enabled"`
	MailboxType     string      `json:"mailbox_type"`
	Mailbox         mailbox.Opt `json:"mailbox"`
	WebhooksEnabled bool        `json:"webhooks_enabled"`
	SESEnabled      bool        `json:"ses_enabled"`
	SendgridEnabled bool        `json:"sendgrid_enabled"`
	SendgridKey     string      `json:"sendgrid_key"`
	Postmark        struct {
		Enabled  bool
		Username string
		Password string
	}

	RecordBounceCB func(models.Bounce) error
}

Opt represents bounce processing options.

type Queries

type Queries struct {
	DB          *sqlx.DB
	RecordQuery *sqlx.Stmt
}

Queries contains the queries.

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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