mirror of
https://github.com/bulwarkmail/webmail.git
synced 2026-10-31 00:12:39 +00:00
Composing a new message while a shared/group folder was selected started it as the reaching login's primary address instead of the shared one, even when a matching send-as identity existed. `composeFromAccountEmail` was resolved from `getAccountById(viewingAccountId ?? activeAccountId)`. A delegated mailbox has no separate login and no AccountEntry, and `setViewingAccount` is only ever called with `null`, so selecting a shared folder leaves both ids pointing at the primary account: `findComposeIdentityId` was handed the wrong address and correctly matched the primary identity. Resolve the address from the selected mailbox instead, falling back to the account lookup for own folders. `accountName` is the JMAP `Account.name`, which RFC 8620 describes as "e.g., the email address of the account"; a server that puts a human label there produces no identity match and the composer keeps the primary identity, which is the previous behaviour. Replies are unaffected - `composeFromAccountEmail` is only read when `mode === 'compose'`. Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>