Documentation
¶
Overview ¶
Package maildir implements the backend.Provider interface for local Maildir mailboxes (the `mutt -f Maildir` style). It is read/edit only — there is no SMTP transport, so SendEmail returns ErrNotSupported.
Folder layout follows Maildir++:
- The configured root path is "INBOX".
- Sibling directories prefixed with "." (e.g. ".Sent", ".Archive") are additional folders. Inner dots map to a "/" hierarchy.
Index ¶
- type Provider
- func (p *Provider) ArchiveEmail(ctx context.Context, folder string, uid uint32) error
- func (p *Provider) ArchiveEmails(ctx context.Context, folder string, uids []uint32) error
- func (p *Provider) Capabilities() backend.Capabilities
- func (p *Provider) Close() error
- func (p *Provider) DeleteEmail(_ context.Context, folder string, uid uint32) error
- func (p *Provider) DeleteEmails(ctx context.Context, folder string, uids []uint32) error
- func (p *Provider) FetchAttachment(_ context.Context, folder string, uid uint32, partID, _ string) ([]byte, error)
- func (p *Provider) FetchEmailBody(_ context.Context, folder string, uid uint32) (string, string, []backend.Attachment, error)
- func (p *Provider) FetchEmails(_ context.Context, folder string, limit, offset uint32) ([]backend.Email, error)
- func (p *Provider) FetchFolders(_ context.Context) ([]backend.Folder, error)
- func (p *Provider) MarkAsRead(_ context.Context, folder string, uid uint32) error
- func (p *Provider) MarkAsUnread(_ context.Context, folder string, uid uint32) error
- func (p *Provider) MoveEmail(_ context.Context, uid uint32, srcFolder, dstFolder string) error
- func (p *Provider) MoveEmails(ctx context.Context, uids []uint32, srcFolder, dstFolder string) error
- func (p *Provider) Search(_ context.Context, folder string, query backend.SearchQuery) ([]backend.Email, error)
- func (p *Provider) SendEmail(_ context.Context, _ *backend.OutgoingEmail) error
- func (p *Provider) Watch(_ context.Context, _ string) (<-chan backend.NotifyEvent, func(), error)
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Provider ¶
type Provider struct {
// contains filtered or unexported fields
}
Provider implements backend.Provider against a local Maildir tree. Two on-disk layouts are supported:
- Maildir++ (dovecot style): the root itself is INBOX (has cur/new/tmp), and subfolders are sibling directories prefixed with "." (e.g. ".Sent").
- Nested (mbsync/isync/fastmail style): the root contains one directory per folder, each holding its own cur/new/tmp. INBOX is the child directory named "INBOX".
The layout is auto-detected at New() time by probing for `<root>/cur`.
func (*Provider) ArchiveEmail ¶
ArchiveEmail moves the message to the Archive subfolder if one exists.
func (*Provider) ArchiveEmails ¶
ArchiveEmails archives the listed messages.
func (*Provider) Capabilities ¶
func (p *Provider) Capabilities() backend.Capabilities
Capabilities reports what the Maildir backend can do.
func (*Provider) DeleteEmail ¶
DeleteEmail removes the message file from disk.
func (*Provider) DeleteEmails ¶
DeleteEmails removes the listed messages from the folder.
func (*Provider) FetchAttachment ¶
func (p *Provider) FetchAttachment(_ context.Context, folder string, uid uint32, partID, _ string) ([]byte, error)
FetchAttachment returns the raw bytes of an attachment part.
func (*Provider) FetchEmailBody ¶
func (p *Provider) FetchEmailBody(_ context.Context, folder string, uid uint32) (string, string, []backend.Attachment, error)
FetchEmailBody returns the chosen body, MIME type, and attachments.
func (*Provider) FetchEmails ¶
func (p *Provider) FetchEmails(_ context.Context, folder string, limit, offset uint32) ([]backend.Email, error)
FetchEmails returns messages from the folder, newest first. Any messages sitting in new/ are first promoted to cur/ (same semantics as mutt opening a Maildir): they remain unread (no Seen flag) but become trackable.
func (*Provider) FetchFolders ¶
FetchFolders returns INBOX plus any subfolders found at the root, using whichever on-disk layout the provider detected.
func (*Provider) MarkAsRead ¶
MarkAsRead sets the Seen flag while preserving the others.
func (*Provider) MarkAsUnread ¶ added in v0.39.0
MarkAsUnread removes the Seen flag while preserving the others.
func (*Provider) MoveEmails ¶
func (p *Provider) MoveEmails(ctx context.Context, uids []uint32, srcFolder, dstFolder string) error
MoveEmails relocates the listed messages between folders.
func (*Provider) Search ¶
func (p *Provider) Search(_ context.Context, folder string, query backend.SearchQuery) ([]backend.Email, error)
Search filters messages in a folder by the given query, parsing headers locally. Body matching scans the decoded body parts.