Documentation
¶
Overview ¶
Package message reads one queued message: the envelope records and the primary headers that `postcat -e -h -q ID` prints. The body is never read. Build turns that into a delivery-focused report and, by default, redacts personal data: local parts become stable pseudonyms, domains stay, and free-text headers are hidden.
Index ¶
Constants ¶
const ( Pending = "pending" // recipient: not delivered yet Delivered = "delivered" // done_recipient: already delivered (or bounced) Canceled = "canceled" // canceled_recipient: dropped as a duplicate )
RecordKind is the envelope record a recipient came from.
const ( Problem = "problem" Warning = "warning" Info = "info" )
Note levels (the same words the doctor uses).
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Header ¶
type Header struct {
Name string `json:"name"`
Value string `json:"value"`
// Redacted: personal content was hidden or reduced. Removed: a secret-like
// header whose value is never shown.
Redacted bool `json:"redacted,omitempty"`
Removed bool `json:"removed,omitempty"`
}
Header is one header as shown in the report.
type Hop ¶
type Hop struct {
From string `json:"from,omitempty"` // the client's HELO name
// FromHost is the client's reverse DNS name as the receiving host saw it
// ("unknown" when it has none).
FromHost string `json:"from_host,omitempty"`
FromIP string `json:"from_ip,omitempty"`
By string `json:"by,omitempty"`
With string `json:"with,omitempty"`
TLS string `json:"tls,omitempty"`
ID string `json:"id,omitempty"`
Time string `json:"time,omitempty"` // RFC 3339
// Authenticated: a SMTP AUTH submission (the client is a person's device;
// its name and address are hidden when redacting).
Authenticated bool `json:"authenticated,omitempty"`
// Local: submitted on the host itself (sendmail/pickup).
Local bool `json:"local,omitempty"`
}
Hop is one Received header, oldest first.
type Note ¶
type Note struct {
Level string `json:"level"`
ID string `json:"id"`
Text string `json:"text"`
Fix string `json:"fix,omitempty"`
}
Note is one observation about the message.
type Options ¶
type Options struct {
Redact bool
Now time.Time
// Entry is this message's postqueue -j entry, if available: it carries
// the delay reasons and the authoritative queue name and arrival time.
Entry *queue.Message
Source string
}
Options for Build.
type Parsed ¶
type Parsed struct {
Path string // e.g. deferred/C/CAF4941D40
Queue string // first path component: incoming, active, deferred, hold, corrupt
QueueID string // last path component
Size int64 // message_size: content length
Arrival time.Time
Sender string // "" is the null sender
HasSender bool
Recipients []RawRecipient
Headers []RawHeader
BodyDropped int // lines after the headers that were ignored
}
Parsed is the postcat output split into its parts.
type RawRecipient ¶
type RawRecipient struct {
Address string
Original string // original_recipient, before aliasing/virtual mapping
Status string
}
RawRecipient is one envelope recipient as stored in the queue file.
type Recipient ¶
type Recipient struct {
Address string `json:"address"`
Domain string `json:"domain"`
Status string `json:"status"` // pending, delivered, canceled
Original string `json:"original_recipient,omitempty"`
DelayReason string `json:"delay_reason,omitempty"`
Category string `json:"category,omitempty"`
Hint string `json:"hint,omitempty"`
Provider string `json:"provider,omitempty"`
Playbook string `json:"playbook,omitempty"`
Temporary *bool `json:"temporary,omitempty"`
}
Recipient is one envelope recipient with its delivery state.
type Report ¶
type Report struct {
QueueID string `json:"queue_id"`
// Queue: incoming, active, deferred, hold or corrupt.
Queue string `json:"queue"`
Arrival string `json:"arrival_time,omitempty"` // RFC 3339
Age string `json:"age,omitempty"`
AgeSeconds int64 `json:"age_seconds,omitempty"`
Size int64 `json:"message_size"`
Sender string `json:"sender"` // "<>" is the null sender (a bounce)
SenderDomain string `json:"sender_domain"`
FromDomain string `json:"from_domain,omitempty"` // domain of the From: header
Recipients []Recipient `json:"recipients"`
Domains []Count `json:"recipient_domains"`
Hops []Hop `json:"hops"`
DKIM []Signature `json:"dkim"`
Headers []Header `json:"headers"`
Notes []Note `json:"notes"`
// Redacted is true unless the CLI was run with --unredacted. Secret-like
// headers are removed either way and the body is never read.
Redacted bool `json:"redacted"`
Source string `json:"source"`
}
Report is everything postsleuth shows about one queued message.
type Signature ¶
type Signature struct {
Domain string `json:"d"`
Selector string `json:"s"`
Algorithm string `json:"a,omitempty"`
// Aligned: d= shares the organizational domain of the From header
// (relaxed DMARC alignment).
Aligned bool `json:"aligned_with_from"`
}
Signature is one DKIM-Signature header.