About this project
Mailserver Configuration Discovery is a Java 21+ library for looking up the mailserver client configuration a domain owner has published, similar to how a mail client discovers settings when a user adds an account. Given a domain or email address, it returns hosts, ports, socket types, and authentication hints for IMAP, POP3, and SMTP.
The library supports two discovery methods: DNS SRV records per RFC 6186 and RFC 8314 (`_submission`, `_submissions`, `_imap`, `_imaps`, `_pop3`, `_pop3s`), and Mozilla Autoconfig XML documents fetched from `https://autoconfig.<domain>/mail/config-v1.1.xml` and `https://<domain>/.well-known/autoconfig/mail/config-v1.1.xml`. It only reports data published by the domain itself; it does not guess hostnames, query third-party databases, or connect to discovered mailservers.
Usage is straightforward: call `MailserverConfigurationDiscovery.discover(...)` with a domain or `EmailAddress`. A context builder allows configuring discovery methods, scopes (submission or reception), DNS servers, timeouts, retries, TCP DNS lookups, HTTP timeouts, insecure HTTP fallback, and a custom executor. Results are returned as a set of `MailserverService` objects, with subtypes for SRV records and Mozilla Autoconfig entries that expose method-specific details such as priority, weight, username, password, authentication methods, and OAuth2 information.
The library is security-conscious: HTTPS is used by default, XML parsing is hardened against XXE, redirects are limited, and plain HTTP fetching is opt-in. It logs through SLF4J and provides DEBUG-level explanations when lookups are ignored. Limitations include no verification of discovered servers, unordered results, partial results on failure, and no support for Mozilla ISPDB, MX-based fallback, Microsoft Autodiscover v2, or the DNS TXT `mailconf=` proposal.
Comments
0 Rating appears after 10 ratings
Sign in to join the discussion.