---
title: How Push Email Works
date: '2026-11-10'
description: 'IMAP IDLE, ActiveSync, JMAP, Graph webhooks, Gmail''s Pub/Sub and iPhone''s Fetch: how each provider says new mail arrived, and why some shows up late.'
author: Pablo Fernandez
tags:
  - Email
  - IMAP
  - JMAP
  - Microsoft 365
  - Gmail
source: 'https://www.pablofr.com/blog/how-push-email-works'
---
Someone asked me whether they could set Outlook for Windows to use Server-Sent Events, or long polling, so new mail would show up faster. The short answer is no: there's no setting for it. The longer answer is more interesting, because both techniques are already in your mail. Microsoft's own phone protocol is long polling, and the newest mail protocol runs on Server-Sent Events. You just don't get to choose. How new mail reaches a screen is decided by the pair of programs at each end, the app and the server, and every provider has picked a different answer.

There are really only three shapes, and every mechanism below is one of them.

```
  poll       app ──▶ "anything new?" ──▶ server
             app ◀── "no"            ◀── server   ...wait N minutes, ask again

  held       app ──▶ "tell me when" ──▶ server   connection held open
             app ◀── "new message"  ◀── server   the moment it lands

  webhook    server ──▶ POST /notify ──▶ your service   (no app connected)
```

*Three ways to learn that mail arrived: ask on a timer, keep a question open, or be called.*

## Asking on a timer

Polling is the oldest answer and still the most common one. POP3 can't do anything else, and any IMAP client can fall back to it: connect, ask what's new, hang up or go quiet, ask again in N minutes. In classic Outlook that's the Send/Receive groups, where you set how many minutes between checks, and `F9` asks right now.

The new Outlook for Windows dropped those controls. Microsoft's [support page](https://support.microsoft.com/en-gb/office/refresh-or-check-for-new-messages-in-outlook-ab319b1e-abf8-4b72-8e29-e256bfac9634) explains why: working offline isn't supported, so "you're always connected to your mail server", and there's "no need for the new Outlook to have the same Send/Receive feature". There's still a Sync button, which asks immediately, but nothing to tune.

Polling's cost is simple to state. Mail arrives on average half an interval late, and every check costs a connection whether anything arrived or not. Check every minute and you're fast and noisy; every fifteen and you're quiet and late.

## Keeping the question open

The fix for both costs is to ask once and let the server answer whenever it has something. Every serious mail protocol has a version of this.

- **IMAP IDLE** ([RFC 2177](https://www.rfc-editor.org/rfc/rfc2177.html), now part of IMAP4rev2): the client selects a folder, sends `IDLE`, and the server writes a line the moment the folder changes. The RFC asks clients to "re-issue it at least every 29 minutes to avoid being logged off", so a client sends `DONE` and starts again twice an hour. Its limit is that it watches the one folder that's selected; mail that a server-side rule files somewhere else isn't announced. [IMAP NOTIFY](https://www.rfc-editor.org/rfc/rfc5465.html) fixes that by watching many folders on one connection, and few clients use it.
- **Exchange ActiveSync**, what Microsoft calls Direct Push, is long polling by name. The phone sends an HTTPS request called `Ping` that asks the server to answer if anything changes in the next 15 minutes. If something does, the [answer](https://learn.microsoft.com/en-us/exchange/direct-push-exchange-2013-help) comes back at once with the folder that changed; if nothing does, the server returns `200 OK` at the 15-minute mark and the phone asks again. A phone that keeps losing the connection tries shorter intervals until it finds what its network will hold open.
- **JMAP** ([RFC 8620](https://www.rfc-editor.org/rfc/rfc8620.html)), the JSON protocol Fastmail designed to replace IMAP, pushes through a URL the server publishes as `eventSourceUrl`: a `text/event-stream` resource, which is exactly Server-Sent Events. [RFC 8887](https://www.rfc-editor.org/rfc/rfc8887.html) adds the same over WebSocket.

So the answer to the original question was hiding in the protocols. Long polling is how Exchange phones get mail, and Server-Sent Events are how JMAP clients do. Outlook on Windows just doesn't speak JMAP, and nothing in its settings would make it.

## Being called

The third shape skips the open connection entirely. It's not for mail apps but for services: a CRM that files every customer email, a helpdesk, a gateway. The provider calls you.

- **Microsoft Graph** [change notifications](https://learn.microsoft.com/en-us/graph/change-notifications-overview): you subscribe to a mailbox's messages and give Graph a URL, and it sends a POST there when one is created or changes. A subscription to Outlook messages lasts at most 10,080 minutes, just under seven days, or 1,440 minutes if you ask for the message's data inside the notification. After that it stops, silently, unless you renewed it.
- **The Gmail API** goes through Google Cloud Pub/Sub instead of a URL of your own. You call [`watch`](https://developers.google.com/workspace/gmail/api/guides/push) on a mailbox, Gmail publishes to a Pub/Sub topic whenever it changes, and Pub/Sub pushes that to you or holds it for you to pull. The notification doesn't carry the message, only a `historyId`; you then ask the history API what changed since the last one you saw. And `watch` has to be called again "at least once every 7 days or you'll stop receiving updates for the user."

Both share the design choice that's easy to miss: the notification is a nudge, not the mail. You still fetch what changed, which keeps the push small and means a lost notification costs you a delay, not a message, as long as you also resynchronize from time to time.

## The phone in your pocket

The iPhone's Mail app sits on top of all this and adds its own layer. Each account is set to Push, Fetch or Manual, and Push only appears when the provider offers it. Apple's [support page](https://support.apple.com/en-us/102578) is blunt about the default: "If Push isn't available as a setting, your account will default to Fetch", and Fetch set to Automatically means the phone downloads new mail in the background "only when your device is charging and connected to Wi-Fi". Out of the house on a phone that isn't charging, an account on Fetch checks when you open the app, or on whatever schedule you picked.

That one setting explains a lot of "my email arrives late on my phone" complaints. Nothing is slow. The account was never pushing.

| Mechanism | Shape | Who uses it | Renewal |
| --- | --- | --- | --- |
| POP3 / IMAP check | poll | every client as a fallback | every N minutes |
| IMAP IDLE | held connection | most IMAP clients | every 29 minutes |
| ActiveSync Ping | long polling | Exchange on phones | every 15 minutes by default |
| JMAP EventSource | Server-Sent Events | JMAP clients | while the stream is open |
| Graph change notifications | webhook | services on Microsoft 365 | before 7 days (1 with data) |
| Gmail API watch | Pub/Sub | services on Gmail | before 7 days |
| iPhone Fetch | poll | iOS Mail without Push | schedule, or charging on Wi-Fi |

## What my server does

[Mailingest](/blog/giving-an-inbox-to-each-agent), my mail platform, offers IDLE, and the way it does it is a useful reminder that push on the wire doesn't mean push all the way down. An IMAP session that's idling wakes up every 30 seconds and asks the database whether its folder changed:

```rust:config.rs
/// How often an IDLE session looks for changes to its mailbox.
pub const IDLE_POLL: Duration = Duration::from_secs(30);
```

To the client it's push: it sent `IDLE` and waits for a line. Inside, it's a poll, so a new message can take up to 30 seconds to be announced. What keeps that cheap is one number. Every arrival, deletion and flag change in a folder takes the folder's next modification sequence, committed with the change, so each wake-up reads a single indexed row; only when that number has moved does the session look at what changed. The code comment remembers the version before: it counted the whole folder twice every 30 seconds per idling connection, "a 250,000-message INBOX each time". The same wake-up is also when a long IDLE notices that the account's login stopped being valid, and closes it.

For services there's the third shape too: an opt-in `message.received` webhook, one per message, sent after the message is stored and [sorted](/blog/gmail-style-tabs-for-any-inbox). JMAP isn't there yet.

So if new mail takes a while to appear, the question isn't which setting is wrong. It's which link in the chain is the slowest: the client that polls every fifteen minutes, the phone that only fetches on Wi-Fi, the IDLE that watches the wrong folder, or the server that checks every thirty seconds behind a protocol that promises the moment. Push is a property of the whole chain, and the chain is only as fast as the link that's still asking on a timer.
