maildir

package
v0.0.0-...-b191538 Latest Latest
Warning

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

Go to latest
Published: Jun 8, 2019 License: MIT Imports: 9 Imported by: 0

Documentation

Overview

Package maildir provides methods for interacting with the Maildir format as specified at http://cr.yp.to/proto/maildir.html

Index

Constants

This section is empty.

Variables

View Source
var ErrorDuplicateKey = errors.New("Key exists more than once.")
View Source
var ErrorUnknownKey = errors.New("Key does not exist in Maildir.")

Functions

This section is empty.

Types

type Dir

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

Dir represents a single Maildir folder.

func Open

func Open(path string, create bool) (md *Dir, err error)

Open opens a maildir. Given create, if the "cur", "tmp", or "new" directories do not exist, they are created.

func (*Dir) Get

func (md *Dir) Get(key string) (msg *Message, err error)

Get finds a message in the Maildir by its unique Key.

func (*Dir) List

func (md *Dir) List() (msgs []Message, err error)

List returns a list of all messages in the Maildir

func (*Dir) NewMessage

func (md *Dir) NewMessage(mail []byte) (msg *Message, err error)

NewMessage writes a raw mail into the Maildir. After writing is complete, the corresponding file is moved to the "new" directory.

type Message

type Message struct {
	// Key is a unique string identifying the message in the Maildir
	Key string
	// contains filtered or unexported fields
}

Message represents a file in a Maildir.

func (*Message) Filename

func (msg *Message) Filename() (string, error)

Filename returns the current path of the file containing Message. Treat with caution as it may become invalid after flags are changed by another MUA for example.

func (*Message) Flags

func (msg *Message) Flags() (flags string, err error)

Flags returns the current flags stored in the message filename.

func (*Message) SetFlags

func (msg *Message) SetFlags(newFlags string) error

SetFlags sets the flags on a message and moves it into the "cur" directory (if not already). newFlags is a string containing at most one letter of the flags defined by the specification: PRSTDF.

Jump to

Keyboard shortcuts

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