29 lines
965 B
Go
29 lines
965 B
Go
// Package imapserver implements a minimal read-mostly IMAP4rev1 server backed by
|
|
// internal/mailstore, so a mail client (Thunderbird etc.) can retrieve mail this
|
|
// server received into a local mailbox. Only a single fixed "INBOX" folder is
|
|
// supported — no folder hierarchy yet (aliases/multiple folders are a later
|
|
// milestone). Login only accepts an app password (esrv_mailbox_app_passwords), never
|
|
// a mailbox's own portal password, since IMAP AUTH has no interactive MFA step.
|
|
package imapserver
|
|
|
|
import (
|
|
"mailgoserver/internal/db"
|
|
"mailgoserver/internal/mailstore"
|
|
"mailgoserver/internal/toolbox"
|
|
|
|
"gopkg.in/ini.v1"
|
|
)
|
|
|
|
// Backend holds the shared dependencies every connection's Session uses, mirroring
|
|
// smtpserver.Backend.
|
|
type Backend struct {
|
|
DB *db.DB
|
|
Mailstore *mailstore.Store
|
|
Logger *toolbox.Logger
|
|
Cfg *ini.File
|
|
}
|
|
|
|
func (b *Backend) NewSession(peerIP string) *Session {
|
|
return &Session{backend: b, peerIP: peerIP}
|
|
}
|