Route all cloud providers' mail through IMAP/SMTP with OAuth2 (XOAUTH2)

FeatureEmailService
Shipped
July 9, 2026 at 5:25 AM UTC
Author
Kamo
Commit
1bc310a

Cloud providers (Microsoft 365, Exchange Online, Google Workspace, Zoho, IceWarp) inherited read/send from **************** but the resolver never populated IMAP/SMTP credentials for them, so every folder/message read threw MailboxNotConfiguredException -> the "email not configured" screen (e.g. org optionone on M365). KamoMail worked only because it alone received credentials (internal Dovecot). Now all providers flow through the one IMAP/SMTP path; KamoMail is unchanged. - MailCredentials: full connection spec **************** - ImapStoreFactory + EmailSmtpService: SASL XOAUTH2 (native com.sun.mail) or basic auth per spec; STARTTLS required (fail-closed) so tokens never transit cleartext. - MailProviderResolver: per-provider credential wiring + member default mailbox + OAuth token refresh. M365/Exchange-Online use app-only client-credentials tokens (outlook.office365.com; **************** tenant derived from the mailbox domain; Google uses service-account domain-wide delegation; Zoho uses the stored OAuth token; IceWarp/on-prem Exchange use basic auth from provider config. - EmailImapService: resolve Sent/Drafts via RFC 6154 SPECIAL-USE so sent copies land in the provider's native folder (Gmail [Gmail]/Sent Mail, Exchange Sent Items). - ProviderController: persist config-form fields into the encrypted configJson (previously dropped); list capabilities without minting a token. - Removed the throwing RealtimeNotifier stubs from cloud providers (polling covers realtime; no push-webhook infra). M365/Exchange-Online require Application IMAP.AccessAsApp + SMTP.SendAsApp with admin consent and New-ServicePrincipal in Exchange Online (scopable per mailbox).

All changes

Like what you see shipping?

Every one of these updates lands in your workspace automatically. Start free and watch it grow week after week.

Start Free ForeverView Pricing