email

package
v0.2.0 Latest Latest
Warning

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

Go to latest
Published: Jun 5, 2026 License: MIT Imports: 7 Imported by: 0

Documentation

Overview

Package email is a thin SMTP sink. It accepts a smtp.Addr-style config at construction time and delivers via net/smtp. No HTML formatting, no templating — that is the publisher's job.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Config

type Config struct {
	Addr     string // host:port, e.g. smtp.example.com:587
	From     string // RFC 5322 mailbox-list
	Username string
	Password string
}

Config is the SMTP connection config. Username may be empty for relays without auth (e.g. local Postfix).

type Recipient

type Recipient struct {
	Address string
}

Recipient is the typed target for the email sink. Address must be a valid RFC 5322 mailbox.

type Sink

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

Sink implements sinks.Sink via net/smtp.SendMail.

func New

func New(cfg Config) (*Sink, error)

New constructs a Sink. Returns a coded error if Addr or From are empty.

func NewNamed

func NewNamed(name string, cfg Config) (*Sink, error)

NewNamed constructs a Sink with a custom name. Used by the factory so multiple email sinks (one per backend) can be registered.

func (*Sink) DecodeRecipient

func (s *Sink) DecodeRecipient(raw []byte) (sinks.Recipient, error)

DecodeRecipient round-trips a persisted DLQ recipient back into the typed Recipient. Used by RedisDLQ.Replay.

func (*Sink) Name

func (s *Sink) Name() string

Name returns the registry key.

func (*Sink) Send

func (s *Sink) Send(ctx context.Context, to sinks.Recipient, m sinks.Message) error

Send delivers m to the email Recipient.

Jump to

Keyboard shortcuts

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