Skip to content

Read account addresses that Mail records as the account URL authority - #5

Merged
mattt merged 1 commit into
mainfrom
mattt/account-email-lookup
Oct 22, 2026
Merged

mattt merged 1 commit into
mainfrom
mattt/account-email-lookup

Conversation

@mattt

@mattt mattt commented Oct 22, 2026

Copy link
Copy Markdown
Owner

iMCP's Mail service (mattt/iMCP#239) reported no account email for any mailbox on a real V10 store. Envelope read the address only from the user part of each AccountURL in MailData/Signatures/AccountsMap.plist, such as imap://user%[email protected]/. A V10 map read by the che-apple-mail-mcp maintainer (PsychQuant/che-apple-mail-mcp#11) records IMAP accounts as imap://user%40example.com/ instead: the percent-encoded address is the whole authority, so URLComponents reports it as the host and the user is nil. Exchange accounts record ews://<opaque identifier>/, which has no address.

Account.Map now reads the address from the host when the URL has no user, and still reads it from the user when a server host follows. Accounts without an address in their URL, such as Exchange accounts, still have a nil email.

A missing or unreadable map still gives no addresses without an error, but Envelope now logs the reason with the subsystem Envelope and the category Accounts: the map is missing, cannot be read, or is not in a recognized format; an entry has no address, with its URL scheme; or mailboxes refer to an account that the map does not list. Account identifiers in these messages are private. The README describes where addresses come from and how to stream these messages.

Current stores record an IMAP account's address as the whole authority
of its AccountURL, such as imap://user%40example.com/, so URLComponents
reports the address as the host and no user. Read the address from the
host when the URL has no user, and keep reading the user form.

Log why the account map gives no address: a missing, unreadable, or
unrecognized map, an entry without an address, or an account that
mailboxes refer to but the map does not list.
@mattt
mattt marked this pull request as ready for review October 22, 2026 13:02
@mattt
mattt merged commit ee90482 into main Oct 22, 2026
4 checks passed
@mattt
mattt deleted the mattt/account-email-lookup branch October 22, 2026 13:02
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant