mail

package
v0.7.0 Latest Latest
Warning

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

Go to latest
Published: Nov 21, 2026 License: Apache-2.0 Imports: 11 Imported by: ? modules, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

Documentation

Overview

Package mail sends plain-text notices through an SMTP server (the updater's mails to the admin). Without a host it only logs what it would send, as etherpad-lite does.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Message

func Message(from, to, subject, body string, now time.Time) []byte

Message renders a plain-text message.

func Port

func Port(c Config) int

Port is the configured port, 587 when unset.

func TransportKey

func TransportKey(c Config) string

TransportKey identifies the connection settings: when it changes (host, port, TLS or login, after settings were saved) a new client is built. etherpad-lite's smtpTransportKey; a host-only key would keep rotated credentials or a new port from taking effect.

Types

type Config

type Config = settings.MailSettings

Config is the SMTP part of the settings.

type Mailer

type Mailer struct {
	Settings func() Config
	Logger   *zap.SugaredLogger
	// contains filtered or unexported fields
}

Mailer sends mail with the settings it reads at every send, so saved settings apply without a restart.

func New

func New(cfg func() Config, logger *zap.SugaredLogger) *Mailer

New builds a mailer.

func (*Mailer) Send

func (m *Mailer) Send(to, subject, body string) error

Send delivers one mail. Without a host or sender it logs the mail and returns nil: the notice was "sent" as far as the caller's dedupe goes.

Jump to

Keyboard shortcuts

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