smtpmail

package
v0.56.2 Latest Latest
Warning

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

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

Documentation

Overview

Package smtpmail sends the mails of the API, such as login links, through an authenticated SMTP server reached over implicit TLS (RFC 8314).

Index

Constants

This section is empty.

Variables

View Source
var ErrConfig = errors.New("smtp: incomplete configuration")

ErrConfig means a Config misses a value.

Functions

This section is empty.

Types

type Config

type Config struct {
	// Addr is the host and port of the server, which speaks TLS at once,
	// such as "smtp.mail.ovh.net:465".
	Addr string
	// Username and Password authenticate with AUTH PLAIN, sent over TLS
	// only.
	Username string
	Password []byte
	// From is the sender address.
	From domain.Email
	// RootCAs are the authorities the server's certificate must chain to;
	// nil means those of the system.
	RootCAs *x509.CertPool
	// Now dates the mails; nil means time.Now.
	Now func() time.Time
	// Random draws the message identifiers; nil means crypto/rand.Reader.
	Random io.Reader
}

Config configures a Sender.

type Sender

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

Sender sends plain text mails. It implements app.Mailer.

func New

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

New returns the Sender of cfg.

func (*Sender) Send

func (s *Sender) Send(ctx context.Context, to domain.Email, subject, body string) error

Send sends to to the plain text mail of subject and body. Its errors never quote the address, nor the server's replies, which may.

Jump to

Keyboard shortcuts

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