Contents · Forum Home · StreamSec Tools 4.1.5.363 documentation

StreamSec.Mail.POP3Client

The collecting half, on TsmCustomTLSClient, and the same shape as
  StreamSec.Mail.SMTPClient: Open brings the session to TRANSACTION state -
  connect, greeting, CAPA, STLS and a SECOND CAPA on the upgrade path,
  authentication when UserName is set - and everything after that is a command.

  THE SECOND CAPA IS NOT TIDINESS. The capability list read in cleartext was
  chosen by whoever controlled the cleartext connection, which on the upgrade
  path is exactly the attacker STLS exists to remove. Learn it again inside TLS
  or the client is deciding what to do next from data the attacker wrote.

  IT WILL NOT SEND A PASSWORD IN THE CLEAR, whatever the consumer configured.
  USER/PASS is the password itself; SASL PLAIN and LOGIN are the password under
  base64. All three are refused on a cleartext connection unconditionally -
  stricter than RequireTLS, and the same posture TsmCustomSMTPClient takes.
  APOP is not implemented: it is the one mechanism that does NOT send the
  password, but it requires the SERVER to hold something equivalent to it, and
  this library's own server keeps an Argon2id verifier precisely so it cannot.

  READING A MULTI-LINE RESPONSE IS DONE ON RAW OCTETS, not through the base's
  ReadLine, and for two independent reasons:

    - ReadLine accepts a BARE LF as a terminator. On input this client
      recognises the end of a response ONLY at CRLF '.' CRLF, so an embedded
      bare newline in somebody's mail cannot truncate a retrieval and leave the
      remainder to be parsed as protocol. That is the strict half of the
      asymmetry whose lenient half is in the server's stuffer.

    - ReadLine returns a string. A retrieved message is OCTETS - it may be
      8-bit, it may be a signature's exact input - and reassembling it through
      a string loses precisely what S/MIME and DKIM verify over.

Feature notes: Mail subsystem notes (SMTP / POP3 / IMAP)

Classes, interfaces and records

classePOP3ClientError

inherits from eTLSClientError

constructor CreateFail(const aCommand, aText: string); property Command: string read fCommand;
The command that failed, '' when the failure was not a command.

classTsmCustomPOP3Client

inherits from TsmCustomTLSClient

constructor Create(AOwner: TComponent); override; destructor Destroy; override; procedure Open;
Connects and brings the session to TRANSACTION state. On any failure the connection is torn down and the exception re-raised. » member page
procedure Close;
QUIT (best effort) and disconnect. Safe to call at any time. IT IS QUIT THAT COMMITS DELETIONS - RFC 1939 sec.6. Dropping the connection instead leaves every DELE undone, which is the protocol's safety net and not a way to cancel. » member page
procedure Stat(out aCount: Integer; out aOctets: Int64); procedure List(aDest: TStrings);
'n octets' per line, one line per undeleted message. » member page
function ListOne(aIndex: Integer): Int64; procedure Uidl(aDest: TStrings);
'n uid' per line. The identifiers are persistent across sessions, which is what makes leave-on-server collection possible. » member page
function UidlOne(aIndex: Integer): string; function Retrieve(aIndex: Integer): tBytes; overload;
THE MESSAGE, exactly as it is stored. » member page
procedure Retrieve(aIndex: Integer; aDest: TStream); overload; procedure Retrieve(aIndex: Integer; aMessage: TsmEmail); overload;
Parsed. The octets are retained by the entity, so a signature over them still verifies - see StreamSec.Mail.Message. » member page
function Top(aIndex, aLines: Integer): tBytes;
Headers plus aLines lines of body. aLines = 0 is headers only. » member page
procedure Delete(aIndex: Integer);
MARKS ONLY. Nothing is removed until Close sends QUIT. » member page
procedure Reset;
Clears every mark made in this session. » member page
procedure Noop; procedure SetPassword(const aValue: string); property Password: iSecretKey read fPassword write fPassword; property Capabilities: TStrings read GetCapabilities;
The CAPA lines, refreshed on every CAPA - after STLS they reflect the TLS-protected answer. » member page
function SupportsCapability(const aName: string): Boolean; function CapabilityParams(const aName: string): string; property LastReplyText: string read fLastReplyText; property Authenticated: Boolean read fAuthenticated; property SessionOpen: Boolean read fSessionOpen; property UserName: string read fUserName write fUserName;
Authentication runs when this is non-empty. » member page
property AuthMechanism: tPOP3AuthMechanism read fAuthMechanism write fAuthMechanism default pamAuto; property ReplyTimeout: Cardinal read fReplyTimeout write fReplyTimeout default cPOP3DefaultReplyTimeout; property DataTimeout: Cardinal read fDataTimeout write fDataTimeout default cPOP3DefaultDataTimeout; property MaxResponse: Integer read fMaxResponse write fMaxResponse default cPOP3DefaultMaxResponse;
Largest multi-line response accepted, in octets. 0 removes the bound, which leaves a hostile or broken server able to exhaust memory. » member page

classTsmPOP3Client — component reference

inherits from TsmCustomPOP3Client

The self-contained tier: creates and owns its TLS engine, so a client dropped on a form works with no other component wired up. Reach into TLSServer for trust anchors (LoadRootCertsFromFile).

property TLSServer: TsmSimpleTLSInternalServer read GetTLSServer write SetOwnTLSServer;
Created and owned here; the setter refuses a foreign component - see TsmTLSClient, whose tier pattern this mirrors. » member page

classTsmAdvancedPOP3Client — component reference

inherits from TsmCustomPOP3Client

The tier that takes an EXTERNAL engine, so several clients share one set of trust anchors; nil falls back to GlobalServer.

property TLSServer;

Types (enumerations, sets, aliases)

enumtPOP3AuthMechanism

pamAuto prefers SASL PLAIN when the server advertises it and falls back to USER/PASS, which every server has. The explicit members force one.

  tPOP3AuthMechanism = (pamAuto, pamUserPass, pamPlain, pamLogin);

Routines