received

package
v1.8.2 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Nov 22, 2026 License: AGPL-3.0 Imports: 11 Imported by: 0 modules, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

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

View Source
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

func Address(name, addr string) string

Address writes a mailbox as a header does: "Name <addr>", or the address alone without a name.

func Addresses

func Addresses(header string) []string

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 Bare

func Bare(s string) string

Bare is the address of "Name <addr>" (or addr itself), lower-cased.

func Base64

func Base64(s string) ([]byte, error)

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(h map[string][]string, name string) string

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

func HookURL(raw, secret string) (string, error)

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

func MessageIDs(header string) []string

MessageIDs reads the Message-IDs of a References or In-Reply-To header, each with its angle brackets.

func RawHeaders

func RawHeaders(raw []byte) map[string][]string

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 SameURL

func SameURL(a, b string) bool

SameURL compares two URLs without their user information and a trailing slash.

func SpamScore

func SpamScore(raw string, threshold float64) string

SpamScore turns a spam score into a verdict: "spam" at or above threshold, "pass" below it, "" when there is no score.

func Verdict

func Verdict(s string) string

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

func WithoutUser(raw string) string

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.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL