Documentation ¶
Overview ¶
Package maildir provides an interface to mailboxes in the Maildir format.
Index ¶
- Constants
- func Key() (string, error)
- type Delivery
- type Dir
- func (d Dir) Check() error
- func (d Dir) Clean() error
- func (d Dir) Create() error
- func (d Dir) Filename(key string) (string, error)
- func (d Dir) Flags(key string, isKey bool) (string, error)
- func (d Dir) Header(key string) (*mail.Header, error)
- func (d Dir) Keys() ([]string, error)
- func (d Dir) Message(key string) (*mail.Message, error)
- func (d Dir) Move(target Dir, key string) error
- func (d Dir) NewDelivery() (*Delivery, error)
- func (d Dir) Purge(key string) error
- func (d Dir) Remove() error
- func (d Dir) SetFlags(key string, flags string, isKey bool) (string, error)
- func (d Dir) SetInfo(key, info string, isKey bool) (string, error)
- func (d Dir) Unseen() ([]string, error)
- type FlagError
- type KeyError
Constants ¶
const CreateMode = 0700
CreateMode holds the permissions used when creating a directory.
Variables ¶
This section is empty.
Functions ¶
Types ¶
type Delivery ¶
type Delivery struct {
// contains filtered or unexported fields
}
Delivery represents an ongoing message delivery to the mailbox. It implements the WriteCloser interface. When associated Close function is called, the underlying file is moved from tmp to new directory.
type Dir ¶
type Dir string
A Dir represents a single directory in a Maildir mailbox.
func (Dir) Check ¶
Check takes in supplied directory and performs compliance checks to Maildir folder layout. It does not change anything in file system in case it encounters an error.
func (Dir) Clean ¶
Clean removes old files from tmp and should be run periodically. This does not use access time but modification time for portability reasons.
func (Dir) Create ¶
Create creates the directory structure for a Maildir. If the desired Maildir already exists, it returns an error.
func (Dir) Flags ¶
Flags returns the flags for a message sorted in ascending order. See the documentation of SetFlags for details.
func (Dir) Keys ¶
Keys returns a list of file names to use as keys in order to access mails in the cur directory of a Maildir.
func (Dir) NewDelivery ¶
NewDelivery creates a new Delivery.
func (Dir) SetFlags ¶
SetFlags appends an info section to the filename according to the given flags. This function removes duplicates and sorts the flags, but doesn't check whether they conform with the Maildir specification.
The following flags are listed in the specification (http://cr.yp.to/proto/maildir.html):
Flag "D" (draft): the user considers this message a draft; toggled at user discretion. Flag "F" (flagged): user-defined flag; toggled at user discretion. Flag "P" (passed): the user has resent/forwarded/bounced this message to someone else. Flag "R" (replied): the user has replied to this message. Flag "S" (seen): the user has viewed this message, though perhaps he didn't read all the way through it. Flag "T" (trashed): the user has moved this message to the trash; the trash will be emptied by a later user action.