Once an account has one or more push registration (registered with WEBPUSH command), the server sends a push message for each registration every time a change is recorded. This can be a change for the account (for example when a new permanent FLAG is added) or for the subscribed mailboxes (new mail, deletions, flag changes).¶
The server can send EXISTS, EXPUNGE, FETCH, and other responses at any time. Every response relative to a mailbox MUST be preceded by the mailbox name. Every other response, for example relative to the server, must be preceded by ^
. The server MAY send multiple responses in a single push notification.¶
As stated in RFC8291, the cleartext content of push notifications MUST NOT be longer than 3993 bytes. If the server wants to inform the client about a response longer than that, it MAY send a SYNC message.¶
If the server sends a FETCH response, it MUST include a UID FETCH item. Every EXISTS response MUST be followed by a FETCH response. The FETCH response SHOULD contain the UID, the ENVELOPE, and the BINARY if it fits in the message length limits, or SHOULD contain the UID and the ENVELOPE, if it fits in the limits.¶
So, when a new mail comes in, the server sends:¶
Example of a push notification containing multiple responses for the "INBOX" mailbox::¶
INBOX 2 FETCH (UID 2 FLAGS (\Deleted \Seen))
INBOX 2 EXPUNGE
¶
Example of a push notification when a new mail arrives in the "New messages" mailbox:¶
"New Messages" 2 EXISTS
"New Messages" 2 FETCH (UID 3 ENVELOPE \
("Mon, 7 Feb 1994 21:52:25 -0800 (PST)" \
"afternoon meeting" \
(("Fred Foobar" NIL "foobar" "Blurdybloop.example")) \
(("Fred Foobar" NIL "foobar" "Blurdybloop.example")) \
(("Fred Foobar" NIL "foobar" "Blurdybloop.example")) \
((NIL NIL "mooch" "owatagu.siam.edu.example")) \
NIL NIL NIL "<B27397-0100000@Blurdybloop.example>"))
¶
Example of a push notification related to the server configuration, using the general prefix ^
, to inform about a FLAGS
response that is longer than 3993 bytes:¶
Because every responses sent by push notifications start with a prefix (the mailbox name or the general prefix ^
) the client MAY parse the prefix only and choose to synchronize with the server. For example, when the client receives INBOX ANYRESPONSE
, it requests the server for new events.¶
The client MAY also parse the prefix and some events. For example, a client may parse FETCH responses, so it can directly show important informations on the user interface. And synchronize with the server if it receives another response.¶
The client MAY parse the name only of some events too. So when it gets INBOX KNOWN_NOT_IMPORTANT
, the client can ignore it, or choose to synchronize this mailbox with the server during the next periodic synchronization.¶
The server MAY not send events that it consider not important.¶
When the push server returns a 429 Too many requests
, it should have send a Retry-After
headers [RFC9110] to indicate how long the server has to wait before sending another request. If this header is present, the server MUST follow the period requested. If this header is not present, the mail server SHOULD wait 5 minutes before sending another request to this endpoint.¶
When the push server returns another 4XX status code, the mail server MUST removes the registration.¶
When the push server returns a 5XX status code, the mail server SHOULD wait 5 minutes before sending another request to the endpoint.¶