ubmailer

package
v0.0.25 Latest Latest
Warning

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

Go to latest
Published: Sep 13, 2025 License: MIT Imports: 6 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type BackgroundMailer

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

func NewBackgroundMailer

func NewBackgroundMailer(m Mailer) *BackgroundMailer

func (*BackgroundMailer) Send

func (b *BackgroundMailer) Send(job EmailJob)

func (*BackgroundMailer) Start

func (b *BackgroundMailer) Start()

func (*BackgroundMailer) Stop

func (b *BackgroundMailer) Stop()

type EmailJob

type EmailJob struct {
	To       string
	Subject  string
	TextBody string
	HtmlBody string
}

type FileMailer

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

func NewFileMailer

func NewFileMailer(from string, outputDir string) *FileMailer

func (*FileMailer) Send

func (f *FileMailer) Send(job EmailJob) error

type Mailer

type Mailer interface {
	Send(job EmailJob) error
}

func MaybeNewMailer

func MaybeNewMailer(config MailerConfig) Mailer

func NewNoopMailer

func NewNoopMailer() Mailer

func NewSMTPMailer

func NewSMTPMailer(cfg SMTPConfig) (Mailer, error)

type MailerConfig

type MailerConfig struct {
	Type MailerType

	// Default from address
	From string

	// File mailer
	OutputDir string

	// SMTP mailer
	Username string
	Password string
	Host     string
}

type MailerImpl

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

func (*MailerImpl) Send

func (m *MailerImpl) Send(job EmailJob) error

type MailerType

type MailerType string
const (
	// No mailer is used
	None MailerType = "none"

	// Mailer that does nothing
	Noop MailerType = "Noop"

	// Writes emails to a file - does not send
	File MailerType = "file"

	// Sends emails using an SMTP server
	SMTP MailerType = "smtp"
)

type NoopMailer

type NoopMailer struct {
}

func (*NoopMailer) Send

func (n *NoopMailer) Send(job EmailJob) error

type SMTPConfig

type SMTPConfig struct {
	Username string
	Password string
	Host     string
	From     string
}

Jump to

Keyboard shortcuts

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