Feature notes: Mail subsystem notes (SMTP / POP3 / IMAP)
inherits from Exception
(no public members)
inherits from TObject
THE SHARED STATE BEHIND THE RATE AND GREYLIST CHECKS. One instance, handed to both, so a deployment has one object to size, prune and (if it ever matters) replace. Safe from several connection threads at once.
constructor Create;
destructor Destroy; override;
function NoteConnection(const aIP: string): Integer;
function NoteMessage(const aIP: string): Integer;
function NoteFailure(const aIP: string): Integer;
function FailureCount(const aIP: string): Integer;
function GreylistPasses(const aIP, aSender, aRecipient: string; out aWaitMs: Cardinal): Boolean;
procedure Clear;
function PeerCount: Integer;
function GreylistCount: Integer;
property WindowMs: Cardinal read fWindowMs write fWindowMs;
property GreyMinWaitMs: Cardinal read fGreyMinWaitMs write fGreyMinWaitMs;
property GreyLifetimeMs: Cardinal read fGreyLifetimeMs write fGreyLifetimeMs;
property GreyPassesToTrust: Integer read fGreyPassesToTrust write fGreyPassesToTrust;
property MaxPeers: Integer read fMaxPeers write fMaxPeers;
property MaxGreylist: Integer read fMaxGrey write fMaxGrey;
inherits from TInterfacedObject
implements iSpamCheck
WHAT THE PEER CALLED ITSELF. Runs at sstHelo and costs nothing - no lookup, no state, just the string the peer supplied.
constructor Create(const aLocalName: string);
destructor Destroy; override;
function CheckName: string;
function Stages: tSpamStages;
function Evaluate(aContext: tSpamContext; aStage: tSpamStage; out aFinding: tSpamFinding): Boolean;
property LocalName: string read fLocalName write fLocalName;
property LocalAddresses: TStringList read fLocalAddresses;
property NotFqdnPoints: Integer read fNotFqdnPoints write fNotFqdnPoints;
property IsUsPoints: Integer read fIsUsPoints write fIsUsPoints;
property LiteralPoints: Integer read fLiteralPoints write fLiteralPoints;
inherits from TInterfacedObject
implements iSpamCheck
FORWARD-CONFIRMED REVERSE DNS. PTR on the peer's address, then the address records of whatever came back, and the peer's own address must be among them. Both halves are needed: a PTR alone proves nothing, because whoever controls an address block can point it anywhere.
WITH ALL THREE WEIGHTS AT ZERO THIS CHECK ASKS DNS NOTHING - worth knowing, because on a resolver that opens a TCP connection per query the lookups are the expensive part, not the arithmetic.
constructor Create(const aResolver: iDnsResolver);
function CheckName: string;
function Stages: tSpamStages;
function Evaluate(aContext: tSpamContext; aStage: tSpamStage; out aFinding: tSpamFinding): Boolean;
property NoReversePoints: Integer read fNoReversePoints write fNoReversePoints;
property NoForwardPoints: Integer read fNoForwardPoints write fNoForwardPoints;
property ConfirmedCredit: Integer read fConfirmedCredit write fConfirmedCredit;
inherits from TInterfacedObject
implements iSpamCheck
A DNS BLOCKLIST OR ALLOWLIST. The peer's address is reversed under the zone and looked up as an address record; anything in 127.0.0.0/8 is an answer, and the code in the last octet is the zone's own vocabulary.
ONE ANSWER IS NOT A LISTING, and getting this wrong blocks the world: by long convention a zone returns 127.255.255.x - and Spamhaus in particular 127.255.255.252 upward - to say "your query was refused", because the querier is unregistered, over quota, or using a public resolver the zone declines to serve. Read as a listing it condemns every sender at once. Those codes are reported through OnProblem and score nothing.
BEFORE USING A PUBLIC ZONE, READ ITS TERMS. Most forbid commercial or high-volume use without a subscription, and several refuse queries that arrive via a large public resolver - which is what the refusal codes above are telling you.
constructor Create(const aResolver: iDnsResolver; const aZone: string; aAllowList: Boolean = False);
destructor Destroy; override;
function CheckName: string;
function Stages: tSpamStages;
function Evaluate(aContext: tSpamContext; aStage: tSpamStage; out aFinding: tSpamFinding): Boolean;
property Zone: string read fZone;
property Points: Integer read fPoints write fPoints;
property AllowList: Boolean read fAllowList;
property CacheMs: Cardinal read fCacheMs write fCacheMs;
property OnProblem: TGetStrProc read fOnProblem write fOnProblem;
inherits from TInterfacedObject
implements iSpamCheck
HOW MUCH, HOW FAST, FROM ONE ADDRESS. Defers; never refuses.
constructor Create(aTable: tSpamPeerTable);
function CheckName: string;
function Stages: tSpamStages;
function Evaluate(aContext: tSpamContext; aStage: tSpamStage; out aFinding: tSpamFinding): Boolean;
property MaxConnections: Integer read fMaxConnections write fMaxConnections;
property MaxMessages: Integer read fMaxMessages write fMaxMessages;
property MaxFailures: Integer read fMaxFailures write fMaxFailures;
inherits from TInterfacedObject
implements iSpamCheck
GREYLISTING. The first time a triplet of (address, sender, recipient) is seen it is asked to come back; a sender that does is remembered.
IT DEFERS, IT NEVER REFUSES - that is what makes it safe. Every RFC 5321 sender must retry a 4xx, so the only mail it can lose is mail from something that does not implement a queue, which is most of what a filter is for.
Off until tSpamPeerTable.GreyMinWaitMs is set.
constructor Create(aTable: tSpamPeerTable);
function CheckName: string;
function Stages: tSpamStages;
function Evaluate(aContext: tSpamContext; aStage: tSpamStage; out aFinding: tSpamFinding): Boolean;
property SkipAuthenticated: Boolean read fSkipAuthenticated write fSkipAuthenticated;