Documentation
¶
Overview ¶
Package provider recognises which large mailbox provider (Gmail, Microsoft, Yahoo) produced a deferral or bounce, and maps the provider's own codes to a recovery playbook: ordered next steps plus the provider's official pages.
It only reads reply texts. It never contacts a provider, files a request or changes anything.
Index ¶
Constants ¶
const ( Gmail = "gmail" Microsoft = "microsoft" Yahoo = "yahoo" )
Provider ids.
const ( KindDeferral = "deferral" KindBounce = "bounce" KindQueued = "queued" )
Kinds of evidence for Collector.Add.
Variables ¶
var Providers = []Info{ {Gmail, "Gmail / Google Workspace", []string{"google.com", "googlemail.com"}}, {Microsoft, "Microsoft (Outlook.com / Microsoft 365)", []string{"protection.outlook.com", "outlook.com", "hotmail.com", "office365.com"}}, {Yahoo, "Yahoo / AOL", []string{"yahoodns.net", "yahoo.com", "aol.com"}}, }
Providers lists every provider postsleuth knows, in display order.
Functions ¶
func Detect ¶
Detect names the provider behind a failure text: first from the remote host Postfix talked to ("host gmail-smtp-in.l.google.com[...] said:"), then from provider-specific markers in the reply (gsmtp, S3150, [TSS04], ...), then from the recipient domain. It returns "" when nothing matches.
Types ¶
type Collector ¶
type Collector struct {
// contains filtered or unexported fields
}
Collector merges failures from the queue and the log into playbook hits.
type Hit ¶
type Hit struct {
Playbook Playbook `json:"playbook"`
Codes []string `json:"codes_seen"`
Notes []string `json:"code_notes,omitempty"`
Temporary bool `json:"temporary"`
Deferrals int `json:"deferred_attempts"`
Bounces int `json:"bounces"`
Queued int `json:"queued_recipients"`
Domains []string `json:"domains"`
Example string `json:"example"`
}
Hit is a playbook that applies to failures seen on this server, with the evidence: how often, for which domains, and one example reply.
type Info ¶
type Info struct {
ID string `json:"id"`
Name string `json:"name"`
// Hosts are MX / relay host suffixes the provider answers from.
Hosts []string `json:"mx_hosts"`
}
Info describes a provider.
type Match ¶
type Match struct {
Provider string `json:"provider,omitempty"` // gmail, microsoft, yahoo; "" if not recognised
// Playbook is nil when the provider was recognised but has no playbook
// for this reply (e.g. a plain "user unknown").
Playbook *Playbook `json:"-"`
ID string `json:"playbook,omitempty"`
Code string `json:"code,omitempty"` // the provider code seen, e.g. 4.7.28, S3150, TSS04
Note string `json:"code_note,omitempty"` // provider's explanation of Code, if published
// Temporary is true when Postfix's own retries can succeed.
Temporary bool `json:"temporary"`
// contains filtered or unexported fields
}
Match is the result of looking up one reply text.
type Playbook ¶
type Playbook struct {
ID string `json:"id"`
Provider string `json:"provider"`
// Codes is the family of reply codes this playbook covers, for display.
Codes string `json:"codes"`
Title string `json:"title"`
Meaning string `json:"meaning"`
Steps []string `json:"steps"`
Refs []Ref `json:"references"`
// CodeNotes holds the provider's own one-line explanation per code,
// where the provider publishes one (e.g. Outlook.com SC-001..OU-002).
CodeNotes map[string]string `json:"code_notes,omitempty"`
// contains filtered or unexported fields
}
Playbook is an ordered recovery procedure for one provider failure.