Documentation
¶
Overview ¶
Package received holds what the adapters whose provider receives mail (providers.InboundReceiver) share: the hook URL with the route's basic authentication, its check, and the readers that turn a provider's parsed payload into a providers.InboundMessage the same way everywhere (verdicts, addresses, Message-ID lists, base64 content, spam scores).
Index ¶
- Constants
- func Address(name, addr string) string
- func Addresses(header string) []string
- func Bare(s string) string
- func Base64(s string) ([]byte, error)
- func CheckBasic(r *http.Request, route providers.InboundRoute) error
- func CheckToken(got string, route providers.InboundRoute) error
- func Header(h map[string][]string, name string) string
- func HookURL(raw, secret string) (string, error)
- func MessageIDs(header string) []string
- func RawHeaders(raw []byte) map[string][]string
- func SameURL(a, b string) bool
- func SpamScore(raw string, threshold float64) string
- func Verdict(s string) string
- func WithoutUser(raw string) string
Constants ¶
const SpamAssassin = 5.0
SpamAssassin is the score at which SpamAssassin calls a message spam by default (required_score).
Variables ¶
This section is empty.
Functions ¶
func Address ¶
Address writes a mailbox as a header does: "Name <addr>", or the address alone without a name.
func Addresses ¶
Addresses splits an address list header ("A <a@x>, b@y") into its addresses, each as Address writes it; a list that doesn't parse is kept as one entry.
func Base64 ¶
Base64 decodes content a provider sends base64-encoded, with or without padding and line breaks.
func CheckBasic ¶
func CheckBasic(r *http.Request, route providers.InboundRoute) error
CheckBasic checks the hook's basic authentication (providers.InboundUser and the route's secret) in constant time.
func CheckToken ¶
func CheckToken(got string, route providers.InboundRoute) error
CheckToken compares a secret sent as it is (a header) with the route's secret in constant time.
func Header ¶
Header returns the first value of a header in a list of name and value pairs, matching the name without regard to case.
func HookURL ¶
HookURL returns the inbound hook URL with the route's basic authentication in it (https://reputecast:<secret>@host/hooks/inbound/…), for providers that authenticate a URL's user information.
func MessageIDs ¶
MessageIDs reads the Message-IDs of a References or In-Reply-To header, each with its angle brackets.
func RawHeaders ¶
RawHeaders reads the header block of a raw message (what precedes the first blank line), for an adapter that needs a header or two from a message it hands over whole. A message without a parsable header block has none.
func SpamScore ¶
SpamScore turns a spam score into a verdict: "spam" at or above threshold, "pass" below it, "" when there is no score.
func Verdict ¶
Verdict maps a provider's SPF, DKIM or DMARC result to "pass", "fail", "none" or "" (unknown, neutral, a soft failure, or a check that couldn't run, as Amazon SES's GRAY and PROCESSING_FAILED).
func WithoutUser ¶
WithoutUser is a URL without its user information, as providers that keep credentials apart list it; an unparsable URL is returned as it is.
Types ¶
This section is empty.