mailgen

package
v0.3.0 Latest Latest
Warning

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

Go to latest
Published: Oct 28, 2026 License: MIT Imports: 8 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 mailgen generates reproducible synthetic mail: threads, MIME variety and flags, for load tests (make mailtest-seed) and the app's fixture data (tools/uifixture).

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Each

func Each(n int, seed uint64, fn func(Message) error) error

Each generates n messages from seed and calls fn for each in order; fn's error stops generation and is returned. The same n and seed always give the same messages.

func Generate

func Generate(o Options) error

Generate writes the Maildir: cur/, new/ and tmp/ under o.Out, and N messages in cur/, byte-for-byte reproducible from o.Seed.

Types

type Message

type Message struct {
	Index int    // 1-based
	Raw   []byte // the RFC 5322 message, CRLF line endings
	Flags string // Maildir flags in ASCII order: F (flagged), R (answered), S (seen)
}

Message is one generated message.

type Options

type Options struct {
	N    int    // number of messages
	Seed uint64 // the same seed always produces the same bytes
	Out  string // Maildir root; cur/, new/ and tmp/ are created
}

Options say what to generate.

Jump to

Keyboard shortcuts

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