mail

package
v0.1.0 Latest Latest
Warning

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

Go to latest
Published: Nov 29, 2026 License: Apache-2.0 Imports: 16 Imported by: 0 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 Inkless's own emails (signing codes only).

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Log

type Log struct{ Logger *slog.Logger }

Log is the development mailer: it logs a masked recipient and the six-digit code found in the message, and sends nothing. Never use it in production, since codes appear in logs.

func (Log) Send

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

Send logs the code in m instead of delivering it.

type Mailer

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

Mailer delivers a Message.

type Message

type Message struct {
	// To is the recipient address.
	To string
	// Subject is the unencoded subject line.
	Subject string
	// Text is the UTF-8 body.
	Text string
}

Message is one plain-text email.

type SMTP

type SMTP struct {
	// AllowPlaintext permits relays without TLS, such as a development mail
	// catcher on another host. Development mode only.
	AllowPlaintext bool
	// contains filtered or unexported fields
}

SMTP sends mail through one relay. Plain smtp:// requires STARTTLS and smtps:// uses implicit TLS. Only a loopback relay, or any relay when AllowPlaintext is set, may be used without TLS. Credentials are never sent without TLS.

func ParseSMTP

func ParseSMTP(raw, defaultFrom string) (*SMTP, error)

ParseSMTP reads smtp://user:password@host:port?from=address or smtps://. Without from, mail comes from defaultFrom.

func (*SMTP) Send

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

Send delivers msg through the relay. The dial, and the whole exchange, end at ctx's deadline, or after a minute when ctx has none.

Jump to

Keyboard shortcuts

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