mailtest

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: 17 Imported by: 0

Documentation

Overview

Package mailtest supplies an in-process TLS SMTP sink for conformance tests.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Message

type Message struct {
	From       string
	Recipients []string
	Data       string
	TLSVersion uint16
	Username   string
	Password   string
}

type Options

type Options struct {
	Mode          string
	MinTLSVersion uint16
	MaxTLSVersion uint16
	WrongHostname bool
	OnMessage     func(Message) error
}

type Sink

type Sink struct {
	Addr  string
	CAPEM string
	// contains filtered or unexported fields
}

func New

func New(t testing.TB, mode string) *Sink

New starts a TLS-only sink. mode selects implicit or mandatory STARTTLS.

func NewWithOptions

func NewWithOptions(t testing.TB, options Options) *Sink

func Start

func Start(options Options) (*Sink, error)

Start starts the same TLS-only fixture outside a Go test, for browser tests. The caller owns Close. Invalid modes are refused before binding a listener.

func (*Sink) Close

func (s *Sink) Close() error

Close stops the listener and active connections, including when called immediately after Start. Multiple callers can safely share cleanup.

func (*Sink) Messages

func (s *Sink) Messages() []Message

Directories

Path Synopsis
Command mailtest exposes the existing TLS SMTP fixture to browser tests.
Command mailtest exposes the existing TLS SMTP fixture to browser tests.

Jump to

Keyboard shortcuts

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