EVERYTHING A MAILBOX-ACCESS SERVER NEEDS THAT IS NOT ITS PROTOCOL.
TsmCustomMailRetrievalServer is the base the per-protocol components descend
from - StreamSec.Mail.POP3Server today, an IMAP one to follow. Only the engine
and the per-connection session differ between those; the store, the accounts,
the TLS engine, the authentication gate, the counters and the listener
start/stop contract are the same, so they are here and there is exactly one of
each. StartListeners and StopListeners are abstract BECAUSE THE LISTENER
CLASSES ARE PER PROTOCOL - a listener is its port, and 110 and 143 are not the
same port.
IT CARRIES NOTHING ONWARD FOR ANYBODY. Every octet a retrieval server emits is
already in a mailbox on this host, and the only identity it recognises is the
account whose mailbox that is. There is no relay gate here because there is
nothing to relay - which is why tSmtpPortRole has no third member and why a
retrieval port needs none of the SMTP server's machinery.
THE THREE THINGS IT WIRES TOGETHER, and the one rule each brings:
Store StreamSec.Mail.Maildir. THE SAME OBJECT the inbound SMTP server
delivers into - not a second one pointed at the same directory,
because the lock that guards an index rewrite only guards it
against holders of the same lock.
Users StreamSec.Mail.Users. The Argon2id account store. WITHOUT IT, AND
WITHOUT AN OnAuthenticate HANDLER, NOTHING AUTHENTICATES - the
deny-by-default the whole family keeps.
TLS StreamSec.Mobile.TlsInternalServer, for the in-band upgrade. The
implicit-TLS port is a TsmAsyncTLSServer and belongs to the
descendant, because the plugin it registers is per protocol.
THE AUTHENTICATION GATE COLLAPSES EVERY FAILURE into one verdict on purpose:
the account store's distinctions go to the log and no further, or a sign-in
command becomes an account enumerator.Feature notes: Mail subsystem notes (SMTP / POP3 / IMAP)
inherits from Exception
(no public members)
(no public members)
inherits from TComponent
EVERYTHING POP3 AND IMAP SHARE. Only the engine and the per-connection session differ between them, so everything else is here.
constructor Create(AOwner: TComponent); override;
destructor Destroy; override;
property SessionsServed: Integer read fSessionsServed;
property Store: TsmMailStore read fStore write SetStore;
property Users: TsmMailUsers read fUsers write SetUsers;
property TLSServer: TsmSimpleTLSInternalServer read fTLSServer write SetTLSServer;
property ServerName: string read fServerName write fServerName;
property Banner: string read fBanner write fBanner;
property Active: Boolean read fActive write SetActive default False;
property OnAuthenticate: tMailAuthenticateEvent read fOnAuthenticate write fOnAuthenticate;
property OnSessionOpened: tMailSessionEvent read fOnSessionOpened write fOnSessionOpened;
property OnSessionClosed: tMailSessionEvent read fOnSessionClosed write fOnSessionClosed;
property OnLog: tMailServerLogEvent read fOnLog write fOnLog;
The credential, in wiped storage - never a plain string, and never reached over a cleartext channel (the engine refuses the mechanism outright there). aAllow arrives holding the account store's verdict, so a handler that changes nothing keeps it, and one that sets it False can veto a peer the store would have admitted.
A session has opened or closed a maildrop. For a status display and for the log; raised from connection threads, so a handler must be thread-safe.