mail

package
v1.1.0 Latest Latest
Warning

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

Go to latest
Published: Nov 8, 2026 License: MPL-2.0 Imports: 16 Imported by: 0

Documentation

Overview

Package mail prepares immutable SMTP configuration and sends text-only mail. Preparation never resolves DNS, opens connections, or reads operator files.

Index

Constants

View Source
const SendTimeout = 15 * time.Second

Variables

View Source
var (
	ErrDisabled  = errors.New("mail is not configured")
	ErrDelivery  = errors.New("mail delivery failed")
	ErrRecipient = errors.New("mail recipient must be one RFC 5322 address")
	ErrSubject   = errors.New("mail subject must not contain line breaks")
)

Functions

This section is empty.

Types

type Client

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

Client is immutable after construction. Each send owns its connection.

func New

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

func (*Client) Configured

func (c *Client) Configured() bool

func (*Client) Send

func (c *Client) Send(ctx context.Context, to, subject, body string) error

Send opens one verified TLS connection with an absolute operation deadline. Errors deliberately omit SMTP responses, message bodies, and credentials.

type Config

type Config struct {
	Addr, TLS, User, Password, From, EHLO, AllowedCIDRs, CAPEM string
}

Config contains effective mail values. Password is used byte-for-byte.

Jump to

Keyboard shortcuts

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