Skip to main content

Module gmail_sender

Module gmail_sender 

Source
Expand description

Whether a mail’s sender was proven: the sender check get_thread shows for each message, a short line per thread in search_threads, and the option to read a message’s raw header lines.

What it guarantees:

  • The verdicts (SPF, DKIM, DMARC) are read only from the topmost Authentication-Results header whose authserv-id is Google’s own (mx.google.com). Google adds it above everything the sender wrote, so a forged one lower in the mail is never read. The same goes for ARC-Authentication-Results, which says what an earlier hop saw (mail forwarded or delivered through an alias). A mail with none gets no verdict, and nothing is made up.
  • A header that can’t be read with certainty is not read at all (verdict_unreadable): one with a quote or a backslash in it (a sender-chosen address can carry ;, ( and = inside quotes, and so forge a result inside Google’s own header), an unbalanced comment, a result named twice, or one cut for length.
  • Everything returned is a plain value: a verdict is letters only, a domain is letters, digits, dots and hyphens, an address has an ordinary local part. Header text is never copied through as a sentence, and the raw headers come in their own field, one line per header, with control characters (so a line break inside a value) turned into spaces.
  • A pass says the DOMAIN is proven, not that the sender is who you hoped: a lookalike domain passes.

Constants§

RAW_HEADER_CHARS
A message’s raw header lines, and the raw header lines of a whole thread, are cut to these.
RAW_THREAD_CHARS

Functions§

raw_headers
A message’s header lines as the mail carries them, Name: value one to a line, cut to budget (which is lowered by what is shown). The text is the sender’s and the servers’ on the way: it comes in a field of its own, with a note, and a value can’t start a line of its own.
search_check
What search_threads shows of a thread’s latest message: the DMARC verdict and the flags.
sender_check
The sender check of one message (payload as Google’s format=full or format=metadata gives it; labels its label ids). A mail the person wrote (SENT, DRAFT) has no verdict to read.