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”).

So is Microsoft’s, which takes no password at all, only its own sign-in (docs/microsoft.md): Outlook.com’s own domains (hotmail.com, live.fr…, the list Thunderbird’s ISPDB gives them), a domain whose MX is Outlook.com’s (*.olc.protection.outlook.com: a personal account) or Microsoft 365’s (*.mail.protection.outlook.com and its older and newer forms: a work or school account), and settings that name Microsoft’s IMAP server. The ID token settles the kind at sign-in.

Re-exports§

pub use crate::microsoft::Kind as MicrosoftKind;

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 🔒
MICROSOFT_CONSUMER_DOMAINS 🔒
Outlook.com’s own domains, those of personal Microsoft accounts: the list Thunderbird’s ISPDB gives (autoconfig.thunderbird.net/v1.1/outlook.com, read 13 October 2026), but for its exchangers’ domain, olc.protection.outlook.com, which microsoft_mx_kind knows. Exact names only.
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. An account at Microsoft is never sent here: its sending server is set when it is added.
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.
is_microsoft_consumer_domain
Whether a domain is one of Outlook.com’s own (personal Microsoft accounts).
microsoft_found
Microsoft’s servers for an address whose mail Microsoft keeps: IMAP on 993 encrypted from the first byte, submission on 587 with STARTTLS (no 465 at Microsoft), the sending server of its kind; the address as login.
microsoft_if_named 🔒
Settings that name Microsoft’s IMAP server are Microsoft’s mail: its own sign-in, its servers; a personal account’s when they send through Outlook.com’s server, else a work or school one’s.
microsoft_mx_kind
Whether a mail exchanger is Microsoft’s, and of which kind: Outlook.com’s (*.olc.protection.outlook.com: personal accounts, and the addresses of a domain of your own Outlook.com receives), Microsoft 365’s (*.mail.protection.outlook.com, older *.mail.eo.outlook.com and *.mail.protection.outlook.de, and *.mx.microsoft where the domain signs its mail exchange with DNSSEC). A whole label before each, so that names only made to look like these are not taken.
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.