THE SMTP HALF OF StreamSec.Mail.Transport. Everything that moves octets,
performs the handshake, bounds a peer and reaps a thread is in that unit and
is spoken by POP3 and IMAP too; what is here is the part that is SMTP and
could not honestly be anything else:
- the ports, 25 and 587, and 465 for the implicit-TLS attachment;
- RFC 5321's five-minute floor for silence between commands, which is not
RFC 1939's ten or RFC 3501's thirty;
- the admission caps an MX was sized for - transient transactions that
drain in seconds, not the all-day sessions a mailbox server holds;
- tSmtpPortRole, the inbound-exchanger against submission distinction that
decides whether a port may relay at all. POP3 and IMAP have no such
question: every octet they serve is already in a mailbox on this host.
AND THE FOUR PER-PROTOCOL CLASSES. A listener IS its port, so the listener,
the channel it mints, the thread that drives the conversation and the
configuration that describes it all descend from their neutral bases here.
tSmtpChannel and tSmtpConnectionThread are nearly empty today; that is the
honest state of them, and they exist now rather than later because adding a
class between a shipped base and its consumers is a compatibility event and
declaring one is not.
THE INTERFACES DESCEND, AND THEY KEEP THE ORIGINAL GUIDs. iSmtpChannel,
iSmtpConnectionHandler and iSmtpConnectionFactory are the same contracts they
have always been, so the identifiers stay with them and the neutral bases got
fresh ones. That direction matters: Delphi's QueryInterface does not walk
interface ancestry, so if a base carried the SMTP GUID then Supports(aPop3
Channel,iSmtpChannel) would succeed and the split would guard nothing.Feature notes: Mail subsystem notes (SMTP / POP3 / IMAP)
inherits from eMailTransportError
Still raised by everything in this unit, and now also caught by anything that handles the neutral base - which is what lets a consumer serving three protocols write one handler.
(no public members)
(no public members)
inherits from iMailChannel
WHAT AN SMTP CONVERSATION SEES OF ITS TRANSPORT. No members of its own: the contract is the base's, and this exists so that the type an SMTP handler is handed says SMTP - and so that a POP3 channel cannot satisfy it.
(no public members)
inherits from iMailConnectionHandler
ONE SMTP CONNECTION'S CONVERSATION, from the driver's side.
(no public members)
inherits from iMailConnectionFactory
Mints a handler per accepted SMTP connection. The relay component implements it. IT IS HANDED THE OPTIONS OBJECT, NOT A ROLE - the configuration of the port the connection arrived on, already typed, so the factory reads Role off the object itself and needs no second lookup that could pick the other port's configuration. Both parameters are typed for the same reason the base declares no method at all: a neutral signature would put an interface cast and an UNCHECKED class cast on the accept path, and one of those failures is an open relay.
function NewHandler(const aChannel: iSmtpChannel; aOptions: tSmtpListenerOptions): iSmtpConnectionHandler;
inherits from tMailChannel
implements iSmtpChannel
ONE SMTP CONNECTION'S OCTETS. Empty today, and that is the honest statement of it: the class exists because the channel is per-protocol, and because the one line that names a concrete channel class - tMailListener.NewChannel - has to have something to name. A POP3 channel will not be empty: RETR pushes whole messages through the blocked-write path, where SMTP only ever pushes short replies.
(no public members)
inherits from tMailListenerOptions
WHAT AN SMTP PORT IS, on top of what a bound socket is.
constructor Create(aOwner: TPersistent); overload; override;
constructor Create(aOwner: TPersistent; aRole: tSmtpPortRole); reintroduce; overload;
property Role: tSmtpPortRole read fRole;
property MaxConnections default cSmtpDefaultMaxConnections;
property MaxConnectionsPerPeer default cSmtpDefaultMaxPerPeer;
property IdleTimeoutSeconds default cSmtpDefaultIdleSeconds;
property SessionTimeoutSeconds default cSmtpDefaultSessionSeconds;
property PreambleIdleSeconds default cSmtpDefaultPreambleIdleSeconds;
property PreambleSessionSeconds default cSmtpDefaultPreambleSessionSeconds;
property PreamblePressurePercent default cSmtpDefaultPreamblePressurePercent;
(no public members)
inherits from tMailConnectionThread
The SMTP driver. It overrides exactly two things: who answers a connection, and what this protocol calls the upgrade in a log line.
(no public members)
inherits from tMailListener
ONE BOUND SMTP PORT. Not an empty descendant even today: it names the two per-protocol classes, and it re-exposes its configuration and its factory in the types the SMTP driver needs. Both are necessary rather than decorative - the base declares Options and Factory protected, and protected on ANOTHER class in another unit is unreachable from tSmtpConnectionThread, which is not a descendant of the listener.
constructor Create(aOptions: tSmtpListenerOptions; const aFactory: iSmtpConnectionFactory; aEngine: TsmSimpleTLSInternalServer); reintroduce;
property Options: tSmtpListenerOptions read fSmtpOptions;
property Factory: iSmtpConnectionFactory read fSmtpFactory;
WHICH SECURITY POSTURE AN SMTP PORT HAS, not decoration. It decides whether the listener may relay at all and whether it offers AUTH - see StreamSec.Mail.SMTPServer, which reads it off the options object it is handed with every accepted connection. IT HAS EXACTLY TWO MEMBERS AND MUST NEVER GROW A THIRD for a protocol that is not SMTP. RelayPermittedOn(sprInbound) = False and an inbound AuthMechanisms of [] are two independent barriers against an open relay, and both are written as tests on this enum.