imap

package
v1.0.1 Latest Latest
Warning

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

Go to latest
Published: Jan 26, 2026 License: AGPL-3.0 Imports: 22 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Backend

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

Backend implements IMAP backend interface

func NewBackend

func NewBackend(
	userService service.UserServiceInterface,
	mailboxService service.MailboxServiceInterface,
	messageService service.MessageServiceInterface,
	domainRepo repository.DomainRepository,
	rateLimiter *ratelimit.Limiter,
	bruteForce *bruteforce.Protection,
	totpService *totp.TOTPService,
	logger *zap.Logger,
) *Backend

NewBackend creates a new IMAP backend with all dependencies

func (*Backend) Login

func (b *Backend) Login(connInfo *imap.ConnInfo, username, password string) (backend.User, error)

Login authenticates a user

type Mailbox

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

Mailbox implements IMAP mailbox interface

func (*Mailbox) Check

func (m *Mailbox) Check() error

Check requests a checkpoint of the currently selected mailbox

func (*Mailbox) CopyMessages

func (m *Mailbox) CopyMessages(uid bool, seqSet *imap.SeqSet, dest string) error

CopyMessages copies messages to another mailbox

func (*Mailbox) CreateMessage

func (m *Mailbox) CreateMessage(flags []string, date time.Time, body imap.Literal) error

CreateMessage appends a new message to the mailbox

func (*Mailbox) Expunge

func (m *Mailbox) Expunge() error

Expunge permanently removes messages marked for deletion

func (*Mailbox) Info

func (m *Mailbox) Info() (*imap.MailboxInfo, error)

Info returns mailbox information

func (*Mailbox) ListMessages

func (m *Mailbox) ListMessages(uid bool, seqSet *imap.SeqSet, items []imap.FetchItem, ch chan<- *imap.Message) error

ListMessages lists messages in the mailbox

func (*Mailbox) Name

func (m *Mailbox) Name() string

Name returns the mailbox name

func (*Mailbox) SearchMessages

func (m *Mailbox) SearchMessages(uid bool, criteria *imap.SearchCriteria) ([]uint32, error)

SearchMessages searches for messages matching criteria

func (*Mailbox) SetSubscribed

func (m *Mailbox) SetSubscribed(subscribed bool) error

SetSubscribed sets the subscription status

func (*Mailbox) Status

func (m *Mailbox) Status(items []imap.StatusItem) (*imap.MailboxStatus, error)

Status returns mailbox status

func (*Mailbox) UpdateMessagesFlags

func (m *Mailbox) UpdateMessagesFlags(uid bool, seqSet *imap.SeqSet, operation imap.FlagsOp, flags []string) error

UpdateMessagesFlags updates message flags

type Server

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

Server manages IMAP server instances

func NewServer

func NewServer(cfg *config.IMAPConfig, tlsCfg *tls.Config, backend *Backend, logger *zap.Logger) *Server

NewServer creates a new IMAP server manager

func (*Server) Shutdown

func (s *Server) Shutdown(ctx context.Context) error

Shutdown performs graceful shutdown

func (*Server) Start

func (s *Server) Start(ctx context.Context) error

Start starts all IMAP servers

type User

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

User implements IMAP user interface

func (*User) CreateMailbox

func (u *User) CreateMailbox(name string) error

CreateMailbox creates a new mailbox

func (*User) DeleteMailbox

func (u *User) DeleteMailbox(name string) error

DeleteMailbox deletes a mailbox

func (*User) GetMailbox

func (u *User) GetMailbox(name string) (backend.Mailbox, error)

GetMailbox retrieves a specific mailbox

func (*User) ListMailboxes

func (u *User) ListMailboxes(subscribed bool) ([]backend.Mailbox, error)

ListMailboxes lists user's mailboxes

func (*User) Logout

func (u *User) Logout() error

Logout ends the user session

func (*User) RenameMailbox

func (u *User) RenameMailbox(oldName, newName string) error

RenameMailbox renames a mailbox

func (*User) Username

func (u *User) Username() string

Username returns the user's email

Jump to

Keyboard shortcuts

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