Types
SpfPreflightResult = object pass*: bool tempError*: bool raw*: SPF_result_t domain*: string detail*: string
- Raw SPF preflight outcome. pass is true only on SPF_RESULT_PASS; tempError marks DNS/transient failures (retry later); anything else (fail, softfail, permerror, invalid, empty sender) is a hard fail. raw carries the libspf2 result code so callers needing the legacy verdict mapping (neutral/none -> tempfail) can reproduce it exactly.
Procs
proc extractSpfDomain(mailFrom: string): string {....raises: [], tags: [], forbids: [].}
- Envelope sender domain, "" for null path or malformed addresses.
proc querySpfRaw(spfServerPtr: pointer; spfClientIp, spfHeloDomain, mailFrom: string): SpfPreflightResult {. ...raises: [], tags: [], forbids: [].}
- Evaluate SPF for an outbound envelope sender without collapsing the result to a delivery verdict, so DMARC alignment can consume it. Angle brackets are stripped: libspf2 expects a bare address and fails bracketed senders with SPF_E_NOT_SPF.
proc runSpfPreflight(enforce: bool; spfServerPtr: pointer; spfClientIp: string; spfHeloDomain: string; mailFrom: string): DeliveryDecision {. ...raises: [], tags: [], forbids: [].}
- Performs an SPF preflight check for the given delivery request using the provided configuration. Verdict mapping is unchanged from the original implementation.