Skip to content

Add Office 365 shared mailbox support#2763

Open
Kevin-Hamilton wants to merge 1 commit into
Foundry376:masterfrom
Kevin-Hamilton:feat/o365-shared-mailbox
Open

Add Office 365 shared mailbox support#2763
Kevin-Hamilton wants to merge 1 commit into
Foundry376:masterfrom
Kevin-Hamilton:feat/o365-shared-mailbox

Conversation

@Kevin-Hamilton

Copy link
Copy Markdown

Summary

Adds the ability to connect an Office 365 shared mailbox as its own account, using the signed-in user's OAuth credentials — no separate credentials exist for shared mailboxes. This follows the pattern established by Outlook and other clients: shared mailboxes are added from account settings after your own account exists, not during first-run setup.

Pairs with Foundry376/Mailspring-Sync#116, which adds engine support for smtp_username on XOAUTH2 accounts, smtp_verification: "login", and create_helper_folders: false. Until a mailsync build containing #116 ships, adding a shared mailbox fails at account validation (SMTP 535); all existing account types are unaffected by either PR.

UX

  • Preferences → Accounts shows an "Add Shared Mailbox..." button on O365 accounts. It opens the onboarding window directly on a one-field form (new o365SharedMailbox window prop), which explains the permission model: "Full Access" to read, "Send As" to send, read-only otherwise.
  • Continuing runs the normal O365 OAuth flow, with a confirmation chip ("Shared mailbox: address — Change") shown during sign-in.
  • The shared mailbox appears as its own account; the sender name defaults to the signed-in user's display name (Graph /me cannot read the shared mailbox's name) and can be edited in Preferences.

How it works

The shared address becomes the account emailAddress and therefore the IMAP XOAUTH2 identity, while smtp_username stays the signed-in user (O365's SMTP AUTH rejects shared addresses — verified on a live tenant). Two engine-honored settings avoid side effects on a mailbox other people share: the account-add test verifies SMTP credentials without transmitting the "Mailspring SMTP Test Email", and the engine skips provisioning Mailspring/Snoozed in the shared mailbox (snooze is unavailable for these accounts; a follow-up could hide the snooze UI there).

Incidental fixes in the same surface: OAuthSignInPage accepts children rendered below the provider note; the O365 pages use tighter logo padding so their taller content stack fits the fixed-size onboarding window; the Preferences → Accounts action buttons wrap in a flex row instead of overlapping when narrow.

Testing

Verified against a live O365 tenant: shared mailbox with Full Access connects and syncs (folders, inbox); no test email is sent to the shared mailbox; no helper folder is created in it; normal O365/Gmail/IMAP onboarding unchanged. npm run typecheck and eslint clean.

🤖 Generated with Claude Code

Connect an O365 shared mailbox as its own account using the signed-in
user's OAuth credentials, added from Preferences > Accounts > "Add
Shared Mailbox..." on an existing O365 account. The button opens the
onboarding window directly on a shared-address form (new
o365SharedMailbox window prop), then runs the normal O365 OAuth flow
with a confirmation chip showing the pending shared address.

The shared address becomes the account email and IMAP XOAUTH2 identity
(requires "Full Access" on the mailbox). SMTP AUTH rejects a shared
address as the XOAUTH2 identity, so smtp_username stays the signed-in
user, who submits mail as the shared address (requires "Send As").

Shared mailbox accounts also set two new engine-honored settings:
- smtp_verification=login: the account-add test verifies the SMTP
  connection and credentials without transmitting checkAccount's test
  email — reading a shared mailbox must not require send rights, and
  the test email would be visible to every member of the mailbox.
- create_helper_folders=false: the engine must not provision
  "Mailspring/Snoozed" in the shared mailbox (visible to all members);
  snoozing is unavailable in these accounts.

Pairs with Foundry376/Mailspring-Sync#NNN, which honors smtp_username,
smtp_verification, and create_helper_folders for XOAUTH2 accounts.
Without that engine build, adding a shared mailbox fails at validation;
existing account types are unaffected.

Also: OAuthSignInPage accepts children (rendered below the provider
note during sign-in), the O365 pages use tighter logo padding so the
taller content stack fits the fixed-size onboarding window, and the
Preferences > Accounts action buttons wrap in a flex row instead of
overlapping.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
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