--- title: 'Advanced | iOS Mail Push Support' --- ## Introduction iOS Mail currently does not support the IMAP idle extension. Therefore users can only either check manually or configure intervals for fetching mails in their mail account preferences when using the default configuration. To support mail push Dovecot needs to advertise the `XAPPLEPUSHSERVICE` IMAP extension as well as sending the actual push notifications to the Apple Push Notification service (APNs) which will forward them to the device. This can be done with two components: - A Dovecot plugin (`dovecot-xaps-plugin`) which is triggered whenever a mail is created or moved from/to a mail folder. - A daemon service (`dovecot-xaps-daemon`) that manages both the device registrations as well as sending notifications to the APNs. ## Prerequisites - An Apple developer account to create the required Apple Push Notification service certificate. - Knowledge creating Docker images, using the command-line, and creating shell scripts. ## Limitations - You need to maintain a custom `docker-mailserver` image. - Push support is limited to the INBOX folder. Changes to other folders will not be pushed to the device regardless of the configuration settings. - You currently cannot use the same account UUID on multiple devices. This means that if you use the same backup on multiple devices (e.g. old phone / new phone) only one of them will get the notification. Use different backups or recreate the mail account. ## Privacy concerns - The service does not send any part of the actual message to Apple. - The information sent contains the device UUID to notify and the (on-device) account UUID which was generated by the iOS mail application when creating the account. - Upon receiving the notification, the iOS mail application will connect to the IMAP server given by the provided account UUID and fetch the mail to notify the user. - Apple therefore does not know the mail address for which the mail was received, only that a specific account on a specific device should be notified that a new mail or that a mail was moved to the INBOX folder. ## Installation Both components will be built using Docker and included into a custom `docker-mailserver` image. Afterwards the required configuration is added to `docker-data/dms/config`. The registration data is stored in `/var/mail-state/lib-xapsd`. 1. Create a Dockerfile to build a `docker-mailserver` image that includes the [`dovecot-xaps-plugin`](https://github.com/freswa/dovecot-xaps-plugin) as well as the [`dovecot-xaps-daemon`](https://github.com/freswa/dovecot-xaps-daemon). This is required to ensure that the Dovecot plugin is built against the same Dovecot version. The `:edge` tag is used here, but you might want to use a released version instead. ```dockerfile FROM mailserver/docker-mailserver:edge AS dovecot-plugin-xaps WORKDIR /tmp/dovecot-xaps-plugin RUN <= 1.20 causes this issue: https://github.com/freswa/dovecot-xaps-daemon/issues/24#issuecomment-1483876081 # Note that the underlying issue are non-standard-compliant Apple http servers which might get fixed at some point FROM golang:1.19-alpine AS dovecot-xaps-daemon ENV GOPROXY=https://proxy.golang.org,direct ENV CGO_ENABLED=0 WORKDIR /go/dovecot-xaps-daemon RUN <