notify

package
v0.2.0 Latest Latest
Warning

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

Go to latest
Published: Sep 27, 2026 License: MIT Imports: 12 Imported by: 0

Documentation

Overview

Package notify delivers messages to people.

SEAM 4 of 4. The engine sends a small, fixed set of messages — a sign-in link, an invitation — and does not care how they arrive. An application wrapping the engine supplies Slack, Discord, or a queue by implementing one method, without touching anything that composes a message.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Mailer

type Mailer interface {
	Send(ctx context.Context, msg Message) error
}

Mailer delivers a message.

func NewLog

func NewLog(log *slog.Logger) Mailer

NewLog returns a Mailer that writes messages to the log.

This is the zero-configuration default, and deliberately not an error. It is the break-glass path: if accounts are switched on and mail delivery then breaks, the sign-in link in the log is the only way back into the dashboard. That is safe only because reading the log already implies host access, and it is the reason the whole body is logged rather than a summary.

func NewResend

func NewResend(apiKey, from string) (Mailer, error)

NewResend returns a Mailer that sends through Resend's HTTP API.

Chosen alongside SMTP because a self-hoster with no relay still needs mail, and an API key is less to get wrong than a relay. The HTTP call is written directly rather than pulling in an SDK: it is one POST, and a dependency that exists to save fifteen lines is a dependency to keep updated forever.

func NewSMTP

func NewSMTP(cfg SMTPConfig) (Mailer, error)

NewSMTP returns a Mailer that sends through an SMTP relay.

Configuration is validated here rather than at first send, because the first send is a sign-in attempt — and a relay misconfiguration discovered then looks to the operator like sign-in being broken.

type Message

type Message struct {
	To       string
	Subject  string
	TextBody string
}

Message is what the engine wants delivered.

Text only. A control plane's mail is short and transactional, and an HTML body is a rendering surface with nothing to gain from it.

func (Message) Validate

func (m Message) Validate() error

Validate reports whether the message is deliverable.

type SMTPConfig

type SMTPConfig struct {
	Addr     string // host:port
	Username string
	Password string
	From     string
}

SMTPConfig describes an SMTP relay.

Jump to

Keyboard shortcuts

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