Skip to main content

Module discover

Module discover 

Source
Expand description

Finding an account’s IMAP server from its address, the way Thunderbird does (https://wiki.mozilla.org/Thunderbird:Autoconfiguration):

  1. the provider’s own settings, autoconfig.<domain> (cPanel hosts and Nextcloud providers publish them), then <domain>/.well-known/autoconfig;
  2. Thunderbird’s list of providers (ISPDB), which knows Gmail and the big ones;
  3. a guess, imap.<domain> then mail.<domain> on port 993, for you to check.

Only HTTPS: a settings file fetched in clear could send your password to someone else’s server. The ISPDB is told the domain, never the address.

Google’s mail is known before any of that: gmail.com and googlemail.com, and any domain whose mail Google receives (Google Workspace: its MX is smtp.google.com, or aspmx.l.google.com and its kin), asked of the system’s DNS. Google takes no account password there, only an app password or its own sign-in, so the form must know it (docs/google.md, “Mail”).

Structs§

Found
IMAP settings found for an address, with the SMTP server when the settings name one.
Smtp
An SMTP submission server.

Enums§

FoundBy
Where the settings came from, said to you before you type a password.

Constants§

GOOGLE_IMAP
Google’s mail servers, for Gmail and Google Workspace alike.
GOOGLE_SMTP
HTTP 🔒
PROBE 🔒

Functions§

answers 🔒
blocks 🔒
Each <name attributes>body</name>, as (attributes, body).
discover
The IMAP settings for an address.
discover_smtp
The SMTP server of an address: from its settings, else smtp.<domain>, then the IMAP host, on 465.
discover_with 🔒
discover, the domain’s MX asked of mx (the system’s DNS, or a stand-in in tests).
domain_of 🔒
encode 🔒
Percent-encodes a query value (RFC 3986 §2.3 keeps only unreserved characters).
fetch 🔒
google_found
Google’s servers for an address whose mail Google keeps: IMAP on 993 and submission on 465, both encrypted from the first byte; the address as login.
guess 🔒
imap.<domain>, then mail.<domain>, if something answers on port 993.
is_google_domain
Gmail’s own domains.
is_google_mail
Whether Google keeps an address’s mail: its domain is Gmail’s, or its MX (asked of the system’s DNS) is Google’s.
is_google_mail_with 🔒
is_google_mail, the MX asked of mx.
is_google_mx
Whether a mail exchanger is Google’s: smtp.google.com (Workspace since 2023), aspmx.l.google.com and altN.aspmx.l.google.com, aspmxN.googlemail.com. Only Google names hosts under google.com and googlemail.com.
mx_hosts 🔒
The hosts that receive a domain’s mail (its MX records), asked of the system’s DNS as the sender checks do (on Android, the network’s servers, which hickory reads through ConnectivityManager); None when it cannot be asked or does not answer within a few seconds.
parse_config 🔒
Reads the IMAP servers of a config-v1.1.xml file; TLS from the first byte is preferred to STARTTLS (RFC 8314 §3), and plain connections are ignored.
server 🔒
substitute 🔒
Thunderbird’s placeholders: %EMAILADDRESS%, %EMAILLOCALPART%, %EMAILDOMAIN%.
tag 🔒
The text of the first <name>text</name>, trimmed.