mbox

package
v1.0.1 Latest Latest
Warning

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

Go to latest
Published: Oct 24, 2026 License: Apache-2.0 Imports: 7 Imported by: 1 module, 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 mbox reads mailboxes in the mbox format, such as Eudora's .mbx files, and Thunderbird's and Unix mail's mailboxes, which are messages, each after a line which starts with From, the sender, and the date it was received, a message at a time

Index

Constants

View Source
const (
	// ContentType is the content type of a mailbox
	ContentType = "application/mbox"

	// MaxMessageSize is the most of a message which is read
	MaxMessageSize = 32 << 20
)

Variables

This section is empty.

Functions

This section is empty.

Types

type Message

type Message struct {
	// The sender of the message, from its From line, which is empty when it
	// isn't known, as Eudora writes it, ???@???
	Sender string

	// When the message was received, from its From line, in UTC, as the
	// time zone isn't known
	Date time.Time

	// The message, with line feeds, and the lines which start with From,
	// which are escaped as >From, as they are. A message which is longer
	// than MaxMessageSize is cut short.
	Data []byte
}

Message is a message in a mailbox

type Reader

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

Reader reads the messages of a mailbox, a message at a time

func NewReader

func NewReader(r io.Reader) *Reader

NewReader returns a reader of the messages of the mailbox, which can have any line endings, such as a Mac's carriage returns

func (*Reader) Next

func (r *Reader) Next() (*Message, error)

Next returns the next message of the mailbox, or io.EOF when there are no more. Text before the first From line isn't a message.

Jump to

Keyboard shortcuts

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