smtp

package
v0.6.0 Latest Latest
Warning

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

Go to latest
Published: Oct 14, 2026 License: AGPL-3.0 Imports: 17 Imported by: 0

Documentation

Overview

Package smtp is the email notify adapter (R-232, R-374, issue #50).

It reaches people: each notification goes to the email address of every account it names, so Pando's own notifications reach someone who is not looking at the console — which is what R-266 was waiting for. Any SMTP server will do, SendGrid's, Mailgun's and Amazon SES's relays included.

Index

Constants

View Source
const (
	SecurityStartTLS = "starttls"
	SecurityTLS      = "tls"
	SecurityNone     = "none"
)

Security is how the connection is protected.

View Source
const Kind = "smtp"

Kind is the adapter's kind string.

Variables

This section is empty.

Functions

func Info

func Info() api.KindInfo

Info describes this kind of adapter for the forms that configure one.

func Message

func Message(from *mail.Address, to string, n api.Notification, now time.Time) []byte

Message renders one email: plain text, UTF-8, with a subject that cannot carry a header of its own (a line break in an app's name ends there).

Types

type Adapter

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

Adapter sends email.

func New

func New() *Adapter

New returns an unconfigured adapter.

func (*Adapter) Capabilities

func (a *Adapter) Capabilities() api.NotifyCapabilities

Capabilities: email reaches the people a notification names.

func (*Adapter) Category

func (a *Adapter) Category() api.Category

func (*Adapter) Configure

func (a *Adapter) Configure(_ context.Context, raw json.RawMessage) error

Configure reads the configuration core assembled.

func (*Adapter) HealthCheck

func (a *Adapter) HealthCheck(ctx context.Context) error

HealthCheck connects, signs in and says goodbye, sending nothing.

func (*Adapter) Kind

func (a *Adapter) Kind() string

func (*Adapter) Notify

func (a *Adapter) Notify(ctx context.Context, n api.Notification) error

Notify sends one email to each recipient that has an address. A recipient without one is skipped: an account with no email is someone this adapter cannot reach, and the console still can.

type Config

type Config struct {
	Credentials    Credentials `json:"credentials,omitzero"`
	Host           string      `json:"host,omitempty"`
	Port           int         `json:"port,omitempty"`
	Username       string      `json:"username,omitempty"`
	From           string      `json:"from,omitempty"`
	Security       string      `json:"security,omitempty"`
	TimeoutSeconds int         `json:"timeout_seconds,omitempty"`
}

Config is the adapter's configuration.

type Credentials

type Credentials struct {
	Password secret.Value `json:"password,omitzero"`
}

Credentials is what this adapter keeps secret.

Jump to

Keyboard shortcuts

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