Help us shape the future of Go! Take the 2026 Go Developer Survey

mail

package
v0.5.0 Latest Latest
Warning

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

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

Documentation

Overview

Package mail sends Auth's emails: the sign-in codes. In development the emails go to the log; in the cloud, to an SMTP provider.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Redact

func Redact(spec string) string

Parse builds a mailer from its spec: "log", or smtp://user:password@host:587. Redact is the mail setting as logs may show it: without the SMTP password.

Types

type Log

type Log struct{ Logger *slog.Logger }

Log writes emails to the log instead of sending them.

func (Log) Send

func (l Log) Send(_ context.Context, m Message) error

type Mailer

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

Mailer sends emails.

func Parse

func Parse(spec, from string, log *slog.Logger) (Mailer, error)

type Message

type Message struct {
	To      string
	Subject string
	Text    string
}

Message is a plain-text email.

type SMTP

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

SMTP sends emails through an SMTP server with STARTTLS: the submission port 587. Implicit TLS on port 465 is not supported.

func (SMTP) Send

func (s SMTP) Send(ctx context.Context, m Message) error

Jump to

Keyboard shortcuts

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