Event Notifications — Cyrus IMAP 3.10.0-beta1 documentation

- Home
- Download
- Contribute
- Support
- Cyrus SASL

# Cyrus IMAP

# Event Notifications

RFC 5423 standardizes the emission of message store event notifications, and RFC 5465 outlines the IMAP NOTIFY extensions.

New in version 2.5.0.

## Available Event Notifications

- Message Events

    - MessageAppend

    - MessageCopy

    - MessageExpire

    - MessageExpunge

    - MessageMove

    - MessageNew

- Flag Events

    - FlagsClear

    - FlagsSet

    - MessageRead

    - MessageTrash

- Mailbox Events

    - AclChange

    - MailboxCreate

    - MailboxDelete

    - MailboxRename

- Subscription Events

    - MailboxSubscribe

    - MailboxUnSubscribe

- Quota Events

    - QuotaExceed

    - QuotaWithin

    - QuotaChange

- Calendar Events

    - CalendarAlarm

- Access Accounting

    - Login

    - Logout

- Apple Push

    - ApplePushService

## Example Event Notifications

### AclChange

The ACL Change notification is emitted when a command `SETACL` is issued.

Note

This event notification is added to Cyrus IMAP outside of any RFC.

     1{
     2    "aclRights": "lrs",
     3    "aclSubject": "jane@example.org",
     4    "event": "AclChange",
     5    "mailboxID": "imap://john@example.org@imap.example.org/Testfolder_renamed;UIDVALIDITY=1424699807",
     6    "pid": 8048,
     7    "service": "imap",
     8    "timestamp": "2015-02-23T14:57:59.736+01:00",
     9    "uri": "imap://john@example.org@imap.example.org/Testfolder_renamed;UIDVALIDITY=1424699807",
    10    "user": "john@example.org",
    11    "vnd.cmu.sessionId": "imap.example.org-8048-1424699879-1-8051832424702584527"
    12}

### FlagsClear

The FlagsClear notification is emitted when all flags are removed from a message.

This includes `\Deleted`, `\Seen` and `\Flagged`, and as such are, in part, the counter-parts to MessageTrash, MessageRead, and FlagsSet.

     1{
     2    "event": "FlagsClear",
     3    "flagNames": "\\Flagged",
     4    "messages": 1,
     5    "modseq": 43,
     6    "pid": 7721,
     7    "service": "imap",
     8    "timestamp": "2015-02-23T14:50:43.640+01:00",
     9    "uidnext": 4,
    10    "uidset": "3",
    11    "uri": "imap://john@example.org@imap.example.org/INBOX;UIDVALIDITY=1424683682",
    12    "user": "john@example.org",
    13    "vnd.cmu.midset": [
    14        "<4d9618acd0aea6b33683766358351459@example.org>"
    15    ],
    16    "vnd.cmu.sessionId": "imap.example.org-7721-1424699443-1-8479002111695998134",
    17    "vnd.cmu.unseenMessages": 0
    18}

### FlagsSet

The FlagsSet notification is emitted when flags are set on a message, but not including the `\Deleted` and `\Seen` flags, which emit MessageTrash and MessageRead event notifications respectively.

     1{
     2    "event": "FlagsSet",
     3    "flagNames": "\\Flagged",
     4    "messages": 1,
     5    "modseq": 42,
     6    "pid": 7649,
     7    "service": "imap",
     8    "timestamp": "2015-02-23T14:50:21.858+01:00",
     9    "uidnext": 4,
    10    "uidset": "3",
    11    "uri": "imap://john@example.org@imap.example.org/INBOX;UIDVALIDITY=1424683682",
    12    "user": "john@example.org",
    13    "vnd.cmu.midset": [
    14        "<4d9618acd0aea6b33683766358351459@example.org>"
    15    ],
    16    "vnd.cmu.sessionId": "imap.example.org-7649-1424699421-1-11813528620713894618",
    17    "vnd.cmu.unseenMessages": 0
    18}

### Login

     1{
     2    "clientIP": "::1",
     3    "clientPort": 46461,
     4    "event": "Login",
     5    "pid": 7629,
     6    "serverDomain": "::1",
     7    "serverPort": 143,
     8    "service": "imap",
     9    "timestamp": "2015-02-23T14:47:36.097+01:00",
    10    "uri": "imap://imap.example.org",
    11    "user": "john@example.org",
    12    "vnd.cmu.sessionId": "imap.example.org-7629-1424699256-1-3981462903180119079"
    13}

### Logout

     1{
     2    "clientIP": "::1",
     3    "clientPort": 46461,
     4    "event": "Logout",
     5    "pid": 7629,
     6    "serverDomain": "::1",
     7    "serverPort": 143,
     8    "service": "imap",
     9    "timestamp": "2015-02-23T14:47:36.183+01:00",
    10    "uri": "imap://imap.example.org",
    11    "user": "john@example.org",
    12    "vnd.cmu.sessionId": "imap.example.org-7629-1424699256-1-3981462903180119079"
    13}

### MailboxCreate

     1{
     2    "event": "MailboxCreate",
     3    "mailboxID": "imap://john@example.org@imap.example.org/Testfolder;UIDVALIDITY=1424690388",
     4    "pid": 7721,
     5    "service": "imap",
     6    "timestamp": "2015-02-23T14:55:57.621+01:00",
     7    "uri": "imap://john@example.org@imap.example.org/Testfolder;UIDVALIDITY=1424690388",
     8    "user": "john@example.org",
     9    "vnd.cmu.sessionId": "imap.example.org-7721-1424699757-1-18345110432907898457"
    10}

### MailboxDelete

Note

A mailbox deletion event notification is issued once for each top- level mailbox in a hierarchy being deleted.

     1{
     2    "event": "MailboxDelete",
     3    "mailboxID": "imap://john@example.org@imap.example.org/Testfolder_renamed;UIDVALIDITY=1424699807",
     4    "pid": 8070,
     5    "service": "imap",
     6    "timestamp": "2015-02-23T14:58:37.145+01:00",
     7    "uri": "imap://john@example.org@imap.example.org/Testfolder_renamed;UIDVALIDITY=1424699807",
     8    "user": "john@example.org",
     9    "vnd.cmu.sessionId": "imap.example.org-8070-1424699917-1-11277155374959916506"
    10}

### MailboxRename

     1{
     2    "event": "MailboxRename",
     3    "mailboxID": "imap://john@example.org@imap.example.org/Testfolder_renamed;UIDVALIDITY=1424699807",
     4    "oldMailboxID": "imap://john@example.org@imap.example.org/Testfolder;UIDVALIDITY=1424690388",
     5    "pid": 8026,
     6    "service": "imap",
     7    "timestamp": "2015-02-23T14:56:47.466+01:00",
     8    "uri": "imap://john@example.org@imap.example.org/Testfolder_renamed;UIDVALIDITY=1424699807",
     9    "user": "john@example.org",
    10    "vnd.cmu.sessionId": "imap.example.org-8026-1424699807-1-3097981731339369225"
    11}

### MailboxSubscribe

    1{
    2    "event": "MailboxSubscribe",
    3    "pid": 3004,
    4    "service": "imap",
    5    "timestamp": "2015-02-23T18:37:02.344+01:00",
    6    "uri": "imap://john@example.org@imap.example.org/Archive",
    7    "user": "john@example.org",
    8    "vnd.cmu.sessionId": "imap.example.org-3004-1424713022-1-7149274646509524617"
    9}

### MailboxUnSubscribe

    1{
    2    "event": "MailboxUnSubscribe",
    3    "pid": 3003,
    4    "service": "imap",
    5    "timestamp": "2015-02-23T18:37:19.482+01:00",
    6    "uri": "imap://john@example.org@imap.example.org/Testfolder_renamed",
    7    "user": "john@example.org",
    8    "vnd.cmu.sessionId": "imap.example.org-3003-1424713039-1-2806700531460584176"
    9}

### MessageAppend

     1{
     2    "bodyStructure": "((\"TEXT\" \"PLAIN\" (\"CHARSET\" \"ISO-8859-1\") NIL NIL \"QUOTED-PRINTABLE\" 206 4 NIL NIL NIL NIL)(\"APPLICATION\" \"CALENDAR+XML\" (\"CHARSET\" \"UTF-8\" \"NAME\" \"kolab.xml\") NIL NIL \"8BIT\" 2030 NIL (\"ATTACHMENT\" (\"FILENAME\" \"kolab.xml\" \"SIZE\" \"2030\")) NIL NIL) \"MIXED\" (\"BOUNDARY\" \"=_d9aa3c2dd73a9166113254d4ebe07bc8\") NIL NIL NIL)",
     3    "event": "MessageAppend",
     4    "messageSize": 2992,
     5    "messages": 3,
     6    "modseq": 12,
     7    "pid": 7721,
     8    "service": "imap",
     9    "timestamp": "2015-02-23T14:51:29.008+01:00",
    10    "uidnext": 6,
    11    "uri": "imap://john@example.org@imap.example.org/Calendar;UIDVALIDITY=1424683684/;UID=5",
    12    "user": "john@example.org",
    13    "vnd.cmu.envelope": "(\"Mon, 23 Feb 2015 13:51:28 +0000\" \"BBA47B13E4839F49AB1C8047EE7B4FDB-A4BF5BBB9FEAA271\" ((NIL NIL \"john\" \"example.org\")) ((NIL NIL \"john\" \"example.org\")) ((NIL NIL \"john\" \"example.org\")) ((NIL NIL \"john\" \"example.org\")) NIL NIL NIL NIL)",
    14    "vnd.cmu.midset": [
    15        "NIL"
    16    ],
    17    "vnd.cmu.sessionId": "imap.example.org-7721-1424699488-1-10167054345787041319",
    18    "vnd.cmu.unseenMessages": 3
    19}

### MessageCopy

     1{
     2    "event": "vnd.cmu.MessageCopy",
     3    "messages": 1,
     4    "modseq": 9,
     5    "oldMailboxID": "imap://john@example.org@imap.example.org/Sent;UIDVALIDITY=1424683683",
     6    "pid": 8107,
     7    "service": "imap",
     8    "timestamp": "2015-02-23T14:59:49.717+01:00",
     9    "uidnext": 5,
    10    "uidset": "4",
    11    "uri": "imap://john@example.org@imap.example.org/Archive;UIDVALIDITY=1424683684",
    12    "user": "john@example.org",
    13    "vnd.cmu.midset": [
    14        "<4d9618acd0aea6b33683766358351459@example.org>"
    15    ],
    16    "vnd.cmu.oldUidset": "2",
    17    "vnd.cmu.sessionId": "imap.example.org-8107-1424699989-1-8439907626481649843",
    18    "vnd.cmu.unseenMessages": 0
    19}

### MessageExpire

### MessageExpunge

     1{
     2    "event": "MessageExpunge",
     3    "messages": 0,
     4    "modseq": 53,
     5    "pid": 7813,
     6    "service": "imap",
     7    "timestamp": "2015-02-23T14:55:20.562+01:00",
     8    "uidnext": 5,
     9    "uidset": "4",
    10    "uri": "imap://john@example.org@imap.example.org/INBOX;UIDVALIDITY=1424683682",
    11    "user": "john@example.org",
    12    "vnd.cmu.midset": [
    13        "<4d9618acd0aea6b33683766358351459@example.org>"
    14    ],
    15    "vnd.cmu.sessionId": "imap.example.org-7813-1424699720-1-13590468293654033744",
    16    "vnd.cmu.unseenMessages": 0
    17}

### MessageMove

Important

The `MessageMove` event is an event type not documented in an RFC.

     1{
     2    "event": "vnd.cmu.MessageMove",
     3    "messages": 2,
     4    "modseq": 5,
     5    "oldMailboxID": "imap://john@example.org@imap.example.org/INBOX;UIDVALIDITY=1424683682",
     6    "pid": 7685,
     7    "service": "imap",
     8    "timestamp": "2015-02-23T14:52:41.676+01:00",
     9    "uidnext": 4,
    10    "uidset": "3",
    11    "uri": "imap://john@example.org@imap.example.org/Archive;UIDVALIDITY=1424683684",
    12    "user": "john@example.org",
    13    "vnd.cmu.midset": [
    14        "<4d9618acd0aea6b33683766358351459@example.org>"
    15    ],
    16    "vnd.cmu.oldUidset": "3",
    17    "vnd.cmu.sessionId": "imap.example.org-7685-1424699561-1-7444588115769591371",
    18    "vnd.cmu.unseenMessages": 0
    19}

### MessageNew

     1{
     2    "event": "MessageNew",
     3    "messageContent": {
     4        "6": "Return-Path: <john@example.org>\r\nReceived: from imap.example.org ([unix socket])\r\n\t by imap.example.org (Cyrus git2.5+0-Kolab-2.5-67.el6.kolab_3.4) with LMTPA;\r\n\t Mon, 20 Oct 2014 13:34:14 +0200\r\nX-Sieve: CMU Sieve 2.4\r\nX-Virus-Scanned: amavisd-new at example.org\r\nX-Spam-Flag: NO\r\nX-Spam-Score: -0.002\r\nX-Spam-Level: \r\nX-Spam-Status: No, score=-0.002 tagged_above=-10 required=6.2\r\n\ttests=[NO_RECEIVED=-0.001, NO_RELAYS=-0.001] autolearn=ham\r\nMIME-Version: 1.0\r\nContent-Type: text/plain; charset=US-ASCII;\r\n format=flowed\r\nContent-Transfer-Encoding: 7bit\r\nDate: Mon, 20 Oct 2014 13:32:41 +0200\r\nFrom: =?UTF-8?Q?Br=C3=BCederli=2C_Thomas?= <john@example.org>\r\nTo: \"Doe, John\" <john@example.org>\r\nSubject: MessageNew event test\r\nMessage-ID: <a8486f5db6ec207de9b9f069850546ee@example.org>\r\nX-Sender: john@example.org\r\n\r\nThis message should trigger the MessageNew event for john...\r\n...and MessageAppend to /Sent for the sender.\r\n"
     5    },
     6    "messageHeaders": {
     7        "6": {
     8            "Content-Transfer-Encoding": "7bit",
     9            "Content-Type": "text/plain",
    10            "Date": "2014-10-20T11:32:41Z",
    11            "From": [
    12                "Br\u00fcederli, Thomas <john@example.org>"
    13            ],
    14            "MIME-Version": "1.0",
    15            "Message-ID": "<a8486f5db6ec207de9b9f069850546ee@example.org>",
    16            "Received": "from imap.example.org ([unix socket])\r\n\t by imap.example.org (Cyrus git2.5+0-Kolab-2.5-67.el6.kolab_3.4) with LMTPA;\r\n\t Mon, 20 Oct 2014 13:34:14 +0200",
    17            "Return-Path": "<john@example.org>",
    18            "Subject": "MessageNew event test",
    19            "To": [
    20                "Doe, John <john@example.org>"
    21            ],
    22            "X-Sender": "john@example.org",
    23            "X-Sieve": "CMU Sieve 2.4",
    24            "X-Spam-Flag": "NO",
    25            "X-Spam-Level": "",
    26            "X-Spam-Score": "-0.002",
    27            "X-Spam-Status": "No, score=-0.002 tagged_above=-10 required=6.2\r\n\ttests=[NO_RECEIVED=-0.001, NO_RELAYS=-0.001] autolearn=ham",
    28            "X-Virus-Scanned": "amavisd-new at example.org"
    29        }
    30    },
    31    "messageSize": 976,
    32    "messages": 6,
    33    "modseq": 20,
    34    "pid": 2340,
    35    "service": "lmtpunix",
    36    "timestamp": "2014-10-20T13:34:14.966+02:00",
    37    "uidnext": 7,
    38    "uidset": "6",
    39    "uri": "imap://john@example.org@imap.example.org/INBOX;UIDVALIDITY=1411487714/;UID=6",
    40    "user": "john@example.org",
    41    "vnd.cmu.midset": [
    42        "<a8486f5db6ec207de9b9f069850546ee@example.org>"
    43    ],
    44    "vnd.cmu.sessionId": "imap.example.org-2340-1413804854-1",
    45    "vnd.cmu.unseenMessages": 3
    46}

### MessageRead

     1{
     2    "event": "MessageRead",
     3    "messages": 1,
     4    "modseq": 47,
     5    "pid": 7685,
     6    "service": "imap",
     7    "timestamp": "2015-02-23T14:53:44.476+01:00",
     8    "uidnext": 5,
     9    "uidset": "4",
    10    "uri": "imap://john@example.org@imap.example.org/INBOX;UIDVALIDITY=1424683682",
    11    "user": "john@example.org",
    12    "vnd.cmu.midset": [
    13        "<4d9618acd0aea6b33683766358351459@example.org>"
    14    ],
    15    "vnd.cmu.sessionId": "imap.example.org-7685-1424699624-1-9701853636551497828",
    16    "vnd.cmu.unseenMessages": 0
    17}

### MessageTrash

     1{
     2    "event": "MessageTrash",
     3    "messages": 1,
     4    "modseq": 48,
     5    "pid": 7809,
     6    "service": "imap",
     7    "timestamp": "2015-02-23T14:54:02.616+01:00",
     8    "uidnext": 5,
     9    "uidset": "4",
    10    "uri": "imap://john@example.org@imap.example.org/INBOX;UIDVALIDITY=1424683682",
    11    "user": "john@example.org",
    12    "vnd.cmu.midset": [
    13        "<4d9618acd0aea6b33683766358351459@example.org>"
    14    ],
    15    "vnd.cmu.sessionId": "imap.example.org-7809-1424699642-1-2896189896878960640",
    16    "vnd.cmu.unseenMessages": 0
    17}

### QuotaChange

Note

This event may be followed by a QuotaWithin event notification, if the quota change leads the quota root to allow more resources than currently in use.

     1{
     2    "diskQuota": 123456789,
     3    "diskUsed": 2,
     4    "event": "QuotaChange",
     5    "maxMessages": -1,
     6    "messages": 3,
     7    "pid": 8140,
     8    "service": "imaps",
     9    "timestamp": "2015-03-10T16:16:19.255+01:00",
    10    "uri": "imap://john.doe@example.org@kolab.example.org/INBOX",
    11    "user": "john.doe@example.org",
    12    "vnd.cmu.sessionId": "kolab.example.org-8140-1426000578-1-14068443041501787710"
    13}

### QuotaExceed

The `user` parameter in the event notification is the user to whom the quota applies, that is being exceeded, otherwise known as the owner of the Personal Namespace.

Note

Quota being exceeded on shared folders cannot include an "owner" for the quota root.

     1{
     2    "diskQuota": 2,
     3    "diskUsed": 2,
     4    "event": "QuotaExceed",
     5    "maxMessages": -1,
     6    "messages": 3,
     7    "pid": 8210,
     8    "service": "lmtpunix",
     9    "timestamp": "2015-03-10T16:13:40.218+01:00",
    10    "uri": "imap://john.doe@example.org@kolab.example.org/INBOX",
    11    "user": "john.doe@example.org",
    12    "vnd.cmu.sessionId": "kolab.example.org-8210-1426000420-4-9494635035963533515"
    13}

### QuotaWithin

The `QuotaWithin` event typically follows a MailboxDelete [1], MessageExpunge [2], MessageMove [3], or QuotaChange [4].

     1{
     2    "diskQuota": 123456789,
     3    "diskUsed": 2,
     4    "event": "QuotaWithin",
     5    "maxMessages": -1,
     6    "messages": 3,
     7    "pid": 8140,
     8    "service": "imaps",
     9    "timestamp": "2015-03-10T16:16:19.255+01:00",
    10    "uri": "imap://john.doe@example.org@kolab.example.org/INBOX",
    11    "user": "john.doe@example.org",
    12    "vnd.cmu.sessionId": "kolab.example.org-8140-1426000578-1-14068443041501787710"
    13}

Footnotes for QuotaWithin

[1]

A `QuotaWithin` event follows a `MailboxDelete` event if the mailbox deleted resides inside a quota root, and lowers the resources used to below the existing quota thresholds.

[2]

A `QuotaWithin` event follows a `MessageExpunge` event if the messages purged reside inside a quota root, and amount to a number or size that lowers the amount of resources used to below the existing quota thresholds.

[3]

A `QuotaWithin` event follows a `MessageMove` event if the source folder of the messages moved resides inside a quota root, and the target folder to which the messages have been moved does not reside within the same quota root, and the number or size of the messages moves lowers the amount of resources used in the quota root for the source folder of the messages to below the existing quota thresholds.

[4]

A `QuotaWithin` event follows a `QuotaChange` event if the quota change raised the threshold on the amount of resources used within the quota root to a level higher than the existing amount of resources used.

### CalendarAlarm

The `CalendarAlarm` event occurs when a calendar event triggers an alarm.

     1{
     2    "event":"CalendarAlarm",
     3    "pid":3164225,
     4    "serverFQDN":"sloti30t15",
     5    "alarmTime":"20151119T063000Z",
     6    "alarmRecipients":["mailto:mary@example.org"],
     7    "userId":"mary@example.org",
     8    "calendarName":"Calendar",
     9    "uid":"49ba20f5-cb44-4863-aea7-255f37ffc2e7",
    10    "action":"email",
    11    "summary":"Here's a lovely event.  Remind me",
    12    "description":"",
    13    "location":"",
    14    "timezone":"Australia/Melbourne",
    15    "start":"20151119T073000Z",
    16    "end":"20151119T083000Z",
    17    "allDay":0,
    18    "attendeeNames":[],
    19    "attendeeEmails":[],
    20    "attendeeStatus":[],
    21    "organizer":""
    22}

### ApplePushService

While Cyrus supports the Apple Push Service, Apple has only licensed Apple Push for mail to a couple of large mail providers: Fastmail and Yahoo. If you own an OS X Server license, you also get a key for personal use. But it's not a supported option for third party developers at this time.

The `ApplePushService` event occurs when

    1{
    2    "event":"ApplePushService",
    3    "user": "john@example.org",
    4    "apsVersion": "",
    5    "apsAccountId": "",
    6    "apsDeviceToken": "",
    7    "apsSubtopic": "",
    8    "mailboxes": "[array of mailboxIDs]"
    9}

apsVersion

  Version of the Apple Push Service this message is compliant with.

apsAccountId

  Service Provider's accountID with the Apple Push Service.

apsDeviceToken

  Unique identifier for the user's device registered with Apple.

apsSubtopic

  TODO: describe this

Back to Features