Apple clients on macOS
macOS has a Microsoft Exchange account type, set up once in System Settings and shared by Mail, Calendar, Contacts, Reminders and Notes. It uses Exchange Web Services (EWS), so a single account gives Apple’s applications mail, calendars and contacts from Stalwart, where a standard setup needs separate IMAP, CalDAV and CardDAV accounts. Calendar and Contacts learn of changes on the server through EWS streaming notifications, without polling.
The Exchange account is an alternative to the standard setup, not a requirement: Apple’s applications work with Stalwart over IMAP, CalDAV and CardDAV whether or not Exchange support is enabled.
Prerequisites
Section titled “Prerequisites”The Exchange account needs Exchange support enabled on the server, and the following on the Mac:
- The server’s host name and
autodiscover.<domain>resolve to the server, as described in DNS records. - The server’s certificate is trusted. A certificate from a public authority needs nothing more. A private certificate authority must be added to the System keychain as trusted, for example with
sudo security add-trusted-cert -d -r trustRoot -k /Library/Keychains/System.keychain ca.pem.
A quick check from the Mac is a request to the EWS endpoint, which must answer 401 rather than fail with a certificate error:
curl -sS -o /dev/null -w '%{http_code}\n' https://mail.example.com/EWS/Exchange.asmxAdd the account
Section titled “Add the account”The account is added in System Settings:
- Open System Settings › Internet Accounts, choose Add Account and then Microsoft Exchange.
- Enter the name and email address, and choose Sign In.
- At the question “Sign in to your Exchange account using Microsoft?”, choose Configure Manually. The other choice signs in through Microsoft’s cloud service, which does not apply to Stalwart.
- Enter the account password, or an app password for accounts with two-factor authentication, and choose Sign In. macOS looks up the server through Autodiscover.
- If macOS asks for server settings, enter the full email address as user name, and the EWS URL,
https://<host>/EWS/Exchange.asmx, as both the internal and the external URL. - Select the applications to use with the account, such as Mail, Contacts and Calendars, and choose Done.
Contacts creates new contacts in its default account, which is the local account on most Macs. To save new contacts on the server, choose the Exchange account under Contacts › Settings › General › Default Account.
Supported features
Section titled “Supported features”Mail, Calendar and Contacts have been tested over the Exchange account. Mail receives, sends, replies to and forwards messages with attachments, and moves, copies, flags and deletes them. Calendar shows and creates events and recurring series, and answers meeting invitations. Contacts reads and creates contacts.
Known behaviour
Section titled “Known behaviour”Two behaviours are specific to the Apple clients:
- Calendar resubscribes slowly after a server restart. EWS notification subscriptions live in the server’s memory, so a restart ends them. Calendar subscribes again only after about three minutes and does not catch up on its own, so changes made while the server was restarting appear with the next change in that calendar. In a cluster, the same happens when the client reaches another node.
- Sign-in fails with “Unable to verify account name or password”. The password is wrong, or the
401challenge that the client receives does not come from Stalwart, for example because a proxy in front of it adds authentication of its own. Apple’s Exchange client sends credentials only in answer to a challenge that offers Basic authentication, which is what Stalwart sends on the Exchange endpoints.
Other macOS clients
Section titled “Other macOS clients”Outlook for Mac and DavMail have not been tested. The App Store build of Outlook for Mac refuses on-premises Exchange accounts unless it has been activated with a Microsoft 365 licence, with the message “This account cannot be added. Outlook for Mac requires you to activate Microsoft 365 before you can add an On Premises account”.