RFC 5437
Sieve Notification Mechanism: Extensible Messaging and Presence Protocol (XMPP)
RFC 5437: Sieve Notification Mechanism: Extensible Messaging and Presence Protocol (XMPP) ๐
Okay so this one is from the Network Working Group, dated January 2009. The authors are P. Saint-Andre (Cisco) and A. Melnikov (Isode Limited). It's a Standards Track document, so it's an actual official standard, not just vibes ๐ . The header doesn't list anything it obsoletes or updates โจ.
Status of This Memo ๐
This document specifies an Internet standards track protocol for the Internet community, and it's asking for discussion and suggestions for improvements ๐ฌ. For the standardization state and status of this protocol, check the current edition of the "Internet Official Protocol Standards" (STD 1) ๐. Distribution of this memo is unlimited ๐.
Copyright Notice ยฉ๏ธ
Copyright (c) 2009 IETF Trust and the persons identified as the document authors. All rights reserved ๐.
This document is subject to BCP 78 and the IETF Trust's Legal Provisions Relating to IETF Documents (http://trustee.ietf.org/license-info), as they're in effect on the date this document was published. Please read these carefully, because they spell out your rights and restrictions for this document ๐ซถ.
Abstract ๐ธ
This document describes a profile of the Sieve extension for notifications. It lets notifications get sent over the Extensible Messaging and Presence Protocol (XMPP), which you might know as Jabber ๐ฆ.
Table of Contents ๐
1. Introduction ....................................................3
1.1. Overview ...................................................3
1.2. Terminology ................................................3
2. Definition ......................................................3
2.1. Notify Parameter "method" ..................................3
2.2. Test notify_method_capability ..............................3
2.3. Notify Tag ":from" .........................................4
2.4. Notify Tag ":importance" ...................................4
2.5. Notify Tag ":message" ......................................4
2.6. Notify Tag ":options" ......................................4
2.7. XMPP Syntax ................................................4
3. Examples ........................................................6
3.1. Basic Action ...............................................6
3.2. Action with "body" .........................................7
3.3. Action with "body", ":importance", ":message", and
"subject" ..................................................7
3.4. Action with ":from", ":message", ":importance",
"body", and "subject" ......................................8
4. Requirements Conformance ........................................9
5. Internationalization Considerations ............................10
6. Security Considerations ........................................11
7. IANA Considerations ............................................12
8. References .....................................................12
8.1. Normative References ......................................12
8.2. Informative References ....................................13
1. Introduction โจ
1.1. Overview
Okay so the [NOTIFY] extension to the [SIEVE] mail filtering language is basically a framework for sending notifications, and it works by using URIs to say how the notification gets sent ๐ฌ. This document defines how xmpp URIs (see [XMPP-URI]) get used to make notifications over the Extensible Messaging and Presence Protocol [XMPP], which is hugely implemented in Jabber instant messaging tech ๐ฌ๐ฅ.
1.2. Terminology
This document inherits its terminology from [NOTIFY], [SIEVE], and [XMPP] ๐ง . Specifically, the terms "parameter" and "tag" are used the way [NOTIFY] uses them, to describe parts of Sieve scripts. The term "key" is used the way [XMPP-URI] uses it, to describe parts of an XMPP URI ๐.
The capitalized key words "MUST", "MUST NOT", "REQUIRED", "SHALL", "SHALL NOT", "SHOULD", "SHOULD NOT", "RECOMMENDED", "NOT RECOMMENDED", "MAY", and "OPTIONAL" in this document are to be interpreted as described in [TERMS]. ๐
2. Definition ๐
2.1. Notify Parameter "method"
The "method" parameter MUST be a URI that conforms to the xmpp URI scheme (as specified in [XMPP-URI]) and that identifies an XMPP account associated with the email inbox ๐ฎ. The URI MAY include the resource identifier of an XMPP address and/or the query component portion of an XMPP URI. But it SHOULD NOT include an authority component or a fragment identifier component ๐. The processing application MUST extract an XMPP address from the URI, following the processing rules in [XMPP-URI]. The resulting XMPP address MUST be encapsulated in XMPP syntax as the value of the XMPP 'to' attribute ๐.
2.2. Test notify_method_capability
So when there's a notify_method_capability test for the "online" notification-capability, an implementation SHOULD return "yes" if it knows about an active presence session (see [XMPP-IM]) for the specified XMPP notification-uri โ . Otherwise, it SHOULD return "maybe". That's because typical XMPP systems may not let a Sieve engine find out about the presence of XMPP entities ๐คทโโ๏ธ.
2.3. Notify Tag ":from"
If it's included, the ":from" tag MUST be an electronic address that conforms to the "Mailbox" rule defined in [RFC5321] ๐ง. The value of the ":from" tag MAY be included in the human-readable XML character data of the XMPP notification. Alternatively, or in addition, it MAY be transformed into formal XMPP syntax. In that case, it MUST be encapsulated as the value of an XMPP SHIM (Stanza Headers and Internet Metadata) [SHIM] header named "Resent-From" ๐ซถ.
2.4. Notify Tag ":importance"
The ":importance" tag has no special meaning for this notification mechanism, and this spec puts no restriction on how it's used ๐คทโโ๏ธ. The value of the ":importance" tag MAY be transformed into XMPP syntax. That can be in addition to or instead of putting appropriate text in the XML character data of the XMPP <body/> element. If it does get transformed, it SHOULD be encapsulated as the value of an XMPP SHIM (Stanza Headers and Internet Metadata) [SHIM] header named "Urgency". The XML character of that header is "high" if the value of the ":importance" tag is "1", "medium" if it's "2", and "low" if it's "3" ๐ฅ.
2.5. Notify Tag ":message"
If the ":message" tag is included, that string MUST be transformed into the XML character data of an XMPP <body/> element. The string gets generated following the guidelines in Section 3.6 of [NOTIFY] ๐.
2.6. Notify Tag ":options"
The ":options" tag has no special meaning for this notification mechanism. Any handling of this tag is the responsibility of an implementation ๐ง.
2.7. XMPP Syntax
The xmpp mechanism results in an XMPP message being sent to notify a recipient about an email message ๐จ. The general XMPP syntax goes like this:
- The notification MUST be an XMPP
<message/>stanza. - The value of the XMPP 'from' attribute SHOULD be the XMPP address of the notification service associated with the Sieve engine, or the XMPP address of the entity to be notified. The value of the XMPP 'from' attribute MUST NOT be generated from the Sieve ":from" tag ๐ โโ๏ธ.
- The value of the XMPP 'to' attribute MUST be the XMPP address specified in the XMPP URI contained in the "method" notify parameter.
- The value of the XMPP 'type' attribute MUST be 'headline' or 'normal'.
- The XMPP
<message/>stanza MUST include a<body/>child element. If the ":message" tag is included in the Sieve script, that string MUST be used as the XML character data of the<body/>element. If not, and if the XMPP URI contained in the "method" notify parameter specified a "body" key in the query component, that value SHOULD be used. Otherwise, the XML character data SHOULD be some configurable text indicating that the message is a Sieve notification ๐ฌ. - The XMPP
<message/>stanza MAY include a<subject/>child element. If the XMPP URI contained in the "method" notify parameter specified a "subject" key in the query component, that value SHOULD be used as the XML character data of the<subject/>element. Otherwise, the XML character data SHOULD be some configurable text indicating that the message is a Sieve notification ๐ธ. - The XMPP
<message/>stanza SHOULD include a URI, which the recipient can use as a hint for locating the message. It gets encapsulated as the XML character data of a<url/>child element of an<x/>element qualified by the 'jabber:x:oob' namespace, as specified in [OOB]. If included, the URI SHOULD be an Internet Message Access Protocol [IMAP] URL that specifies the location of the message, as defined in [IMAP-URL]. But it MAY be another URI type that can specify or hint at the location of an email message, like a URI for an HTTP resource [HTTP] or a Post Office Protocol Version 3 (POP3) mailbox [POP-URL] where the message can be accessed ๐ฆ. It is not expected that an XMPP user agent shall directly handle such a URI. Instead, it shall invoke an appropriate helper application to handle the URI ๐ง. - The XMPP
<message/>stanza MAY include an XMPP SHIM (Stanza Headers and Internet Metadata) [SHIM] header named "Resent-From". If the Sieve script included a ":from" tag, the "Resent-From" value MUST be the value of the ":from" tag. Otherwise, the "Resent-From" value SHOULD be the envelope recipient address of the original email message that triggered the notification ๐.
3. Examples ๐ง
Okay in these examples, the sender of the email has the address <mailto:juliet@example.org>. The entity to be notified has the email address <mailto:romeo@example.com> and the XMPP address romeo@im.example.com, which makes the XMPP URI <xmpp:romeo@im.example.com>. And the notification service associated with the Sieve engine has the XMPP address notify.example.com ๐.
Note: In the following examples, line breaks are included in XMPP URIs solely for the purpose of readability. ๐
3.1. Basic Action
This is the most basic Sieve notify action, with only a method. Because of that, the XML character data of the XMPP <body/> and <subject/> elements gets generated by the Sieve engine based on configuration. The Sieve engine also includes a URI pointing to the message ๐.
Basic action (Sieve syntax)
notify "xmpp:romeo@im.example.com"
The resulting XMPP <message/> stanza might look like this:
Basic action (XMPP syntax)
<message from='notify.example.com'
to='romeo@im.example.com'
type='headline'
xml:lang='en'>
<subject>SIEVE</subject>
<body><juliet@example.com> You got mail.</body>
<x xmlns='jabber:x:oob'>
<url>
imap://romeo@example.com/INBOX;UIDVALIDITY=385759043/;UID=18
</url>
</x>
</message>
3.2. Action with "body" ๐
Okay so this one has a "body" key in the query part of the XMPP URI but no :message tag in the Sieve script ๐
. That means the XML character data for the XMPP <body/> element gets pulled straight from the URI. The Sieve engine also includes a URI that points to the message ๐.
Action with "body" (Sieve syntax)
notify "xmpp:romeo@im.example.com?message
;body=Wherefore%20art%20thou%3F"
The resulting XMPP <message/> stanza might look like this ๐ฆ
Action with "body" (XMPP syntax)
<message from='notify.example.com'
to='romeo@im.example.com'
type='headline'
xml:lang='en'>
<subject>SIEVE</subject>
<body>Wherefore art thou?</body>
<x xmlns='jabber:x:oob'>
<url>
imap://romeo@example.com/INBOX;UIDVALIDITY=385759044/;UID=19
</url>
</x>
</message>
3.3. Action with "body", ":importance", ":message", and "subject" ๐ฅ
This one is giving main character energy ๐. It sets a :importance tag and a :message tag in the Sieve script, plus a "body" key and a "subject" key in the XMPP URI query. The :message tag wins over the "body" key when the XML character data of the XMPP <body/> element gets generated ๐
โโ๏ธ. The Sieve engine also adds a URI pointing to the message ๐.
Action with "body", ":importance", ":message", and "subject" (Sieve syntax)
notify :importance "1"
:message "Contact Juliet immediately!"
"xmpp:romeo@im.example.com?message
;body=You%27re%20in%20trouble
;subject=ALERT%21"
The resulting XMPP <message/> stanza might be like this โจ
Action with "body", ":importance", ":message", and "subject" (XMPP syntax)
<message from='notify.example.com'
to='romeo@im.example.com'
type='headline'
xml:lang='en'>
<subject>ALERT!</subject>
<body>Contact Juliet immediately!</body>
<headers xmlns='http://jabber.org/protocol/shim'>
<header name='Urgency'>high</header>
</headers>
<x xmlns='jabber:x:oob'>
<url>
imap://romeo@example.com/INBOX;UIDVALIDITY=385759045/;UID=20
</url>
</x>
</message>
3.4. Action with ":from", ":message", ":importance", "body", and "subject" ๐ง
Now we're getting into the full glam ๐
. This action has a :from tag, an :importance tag, and a :message tag in the Sieve script, plus a "body" key and a "subject" key in the XMPP URI query. Same deal as before: the :message tag overrides the "body" key for the XML character data of the XMPP <body/> element ๐ซถ. The Sieve engine adds a URI pointing to the message too, and also an XMPP SHIM (Stanza Headers and Internet Metadata) [SHIM] header called "Resent-From", which wraps up the value of the :from tag ๐ฌ.
Action with ":from", ":importance", ":message", "body", and "subject" (Sieve syntax)
notify :from "romeo.my.romeo@example.com"
:importance "1"
:message "Contact Juliet immediately!"
"xmpp:romeo@im.example.com?message
;body=You%27re%20in%20trouble
;subject=ALERT%21"
The resulting XMPP <message/> stanza might be as follows ๐ฆ
Action with ":from", ":importance", ":message", "body", and "subject" (XMPP syntax)
<message from='notify.example.com'
to='romeo@im.example.com'
type='headline'
xml:lang='en'>
<subject>ALERT!</subject>
<body>Contact Juliet immediately!</body>
<headers xmlns='http://jabber.org/protocol/shim'>
<header name='Resent-From'>romeo.my.romeo@example.com</header>
<header name='Urgency'>high</header>
</headers>
<x xmlns='jabber:x:oob'>
<url>
imap://romeo@example.com/INBOX;UIDVALIDITY=385759045/;UID=21
</url>
</x>
</message>
4. Requirements Conformance ๐
Section 3.8 of [NOTIFY] lays out a set of requirements for Sieve notification methods ๐ธ. Here's how the xmpp notification mechanism measures up, point by point ๐ .
- An implementation of the xmpp notification method SHOULD NOT modify the final notification text (for example, to limit its length) ๐ โโ๏ธ. A given deployment MAY do it though (say, if recipients pay per character or byte for XMPP messages) ๐ธ. Changing the characters themselves shouldn't be needed, since XMPP character data is encoded in [UTF-8] ๐ค.
- An implementation MAY ignore parameters specified in the
:from,:importance, and:optionstags ๐คทโโ๏ธ. - There is no recommended default message for an implementation to include if the
:messagetag isn't specified ๐ซ . - A notification sent via the xmpp notification method MAY include a timestamp in the textual message โฐ.
- The value of the XMPP
'from'attribute MUST be the XMPP address of the notification service associated with the Sieve engine ๐ฎ. The value of the Sieve:fromtag MAY be transformed into the value of an XMPP SHIM (Stanza Headers and Internet Metadata) [SHIM] header named"Resent-From"๐ซ. - The value of the XMPP
'to'attribute MUST be the XMPP address specified in the XMPP URI contained in the"method"parameter ๐ฏ. - Following [XMPP-URI], an implementation MUST ignore any URI action or key it doesn't understand (so the URI MUST be processed as if that action or key wasn't there at all) ๐. It is RECOMMENDED to support the XMPP
"message"query type (see [QUERIES]) and the associated"body"and"subject"keys, which SHOULD be mapped to the XMPP<body/>and<subject/>child elements of the XMPP<message/>stanza, respectively ๐. Still, if they're included, the Sieve notify:messagetag MUST be mapped to the XMPP<body/>element, overriding the"body"key (if any) in the XMPP URI ๐. - An implementation MUST NOT include any other extraneous information that isn't specified in parameters to the notify action ๐ซ.
- When it gets a notify_method_capability test for the
"online"notification-capability, an implementation SHOULD return a value of"yes"if it knows about an active presence session (see [XMPP-IM]) for the specified XMPP notification-uri ๐ข. That only holds if the entity asking for the test is authorized to know the presence of the associated XMPP entity (for example, through an explicit presence subscription as specified in [XMPP-IM]) ๐. Otherwise, it SHOULD return a value of"maybe"๐ค. That's because typical XMPP systems may not let a Sieve engine learn about the presence of XMPP entities ๐. - An implementation SHOULD NOT attempt to retry delivery of a notification if it gets an XMPP error of type
"auth"or"cancel"๐. It MAY attempt to retry delivery if it gets an XMPP error of type"wait"โณ. It MAY also attempt to retry delivery if it gets an XMPP error of"modify", but only if it makes appropriate modifications to the notification (see [XMPP]) โ๏ธ. In any case, the number of retries SHOULD be limited to a configurable number no less than 3 and no more than 10 ๐ข. An implementation MAY throttle notifications if the number of notifications within a given time period gets excessive according to local service policy ๐ฆ. Duplicate suppression (if any) is a matter for the implementation and isn't specified here ๐งผ.
5. Internationalization Considerations ๐
Okay, so an XMPP address can hold almost any [UNICODE] character ๐. But the value of the "method" parameter MUST be a Uniform Resource Identifier (see [URI]) and NOT an Internationalized Resource Identifier (see [IRI]) ๐. The rules in [XMPP-URI] MUST be followed when generating XMPP URIs ๐.
In accordance with Section 13 of RFC 3920, all data sent over XMPP MUST be encoded in [UTF-8] ๐คโจ.
6. Security Considerations ๐
Depending on what information is included, sending a notification can be comparable to forwarding mail to the notification recipient ๐จ. Be careful when forwarding mail automatically, so confidential information doesn't end up in an insecure environment ๐จ. Most importantly, implementations MUST conform to the security considerations given in [NOTIFY], [SIEVE], and [XMPP] ๐.
[NOTIFY] says that a notification method MUST provide mechanisms for avoiding notification loops ๐. One kind of loop can be caused by message forwarding, but those loops are prevented because XMPP doesn't support forwarding messages from one XMPP address to another ๐. Another kind of loop can be caused by auto-replies to XMPP messages received by the XMPP notification service associated with the Sieve engine ๐ค. So that service MUST NOT auto-reply to XMPP messages it receives ๐.
A super common use case is a user making a script so the Sieve engine acts differently when they're currently available at a particular type of service (for example, sending notifications to the user's XMPP address if they have an active session at an XMPP service) ๐ฌ. Whether the user is currently available can be figured out with a notify_method_capability test for the "online" notification-capability ๐ข. In XMPP, info about current network availability is called "presence" (see also [MODEL]) ๐. Since [XMPP-IM] requires that a user approve a presence subscription before an entity can get access to that user's presence information, a limited but reasonably safe approach might be for the Sieve engine to request a subscription to the user's presence ๐ซฃ. The user would then need to approve that subscription request, so the Sieve engine can act properly depending on whether the user is online or offline ๐ซ.
Here's the big warning, bestie ๐จ: the Sieve engine MUST NOT use the user's presence information when processing scripts on behalf of a script owner other than the user, unless the Sieve engine has explicit knowledge (for example, through integration with an XMPP server's presence authorization rules) that the script owner is authorized to know the user's presence ๐ โโ๏ธ๐. A more advanced approach to delegating presence authorization could be designed, but any such approach is left to future standards work ๐ฎ.
7. IANA Considerations ๐๏ธ
The following template handles the IANA registration of the Sieve notification mechanism described in this document ๐:
To: iana@iana.org
Subject: Registration of new Sieve notification mechanism
Mechanism name: xmpp
Mechanism URI: RFC 5122 [XMPP-URI]
Mechanism-specific options: none
Permanent and readily available reference: RFC 5437
Person and email address to contact for further information:
Peter Saint-Andre <registrar@xmpp.org>
This info has been added to the list of Sieve notification mechanisms maintained at <http://www.iana.org> ๐ฆ.
8. References ๐
8.1. Normative References โจ
okay bestie, these are the must-reads ๐ If you want the full picture, these are the docs this one leans on hardcore ๐
- [NOTIFY] Melnikov, A., Ed., Leiba, B., Ed., Segmuller, W., and T. Martin, "Sieve Email Filtering: Extension for Notifications", RFC 5435, January 2009.
- [OOB] Saint-Andre, P., "Out of Band Data", XSF XEP 0066, August 2006.
- [QUERIES] Saint-Andre, P., "XMPP URI Scheme Query Components", XSF XEP 0147, September 2006.
- [RFC5321] Klensin, J., "Simple Mail Transfer Protocol", RFC 5321, October 2008.
- [SHIM] Saint-Andre, P. and J. Hildebrand, "Stanza Headers and Internet Metadata", XSF XEP 0131, July 2006.
- [SIEVE] Guenther, P., Ed. and T. Showalter, Ed., "Sieve: An Email Filtering Language", RFC 5228, January 2008.
- [TERMS] Bradner, S., "Key words for use in RFCs to Indicate Requirement Levels", BCP 14, RFC 2119, March 1997.
- [XMPP-URI] Saint-Andre, P., "Internationalized Resource Identifiers (IRIs) and Uniform Resource Identifiers (URIs) for the Extensible Messaging and Presence Protocol (XMPP)", RFC 5122, February 2008.
8.2. Informative References ๐ฆ
these ones are more like the background reading that gives you the vibe, not strictly required to get the spec working ๐ธ
- [HTTP] Fielding, R., Gettys, J., Mogul, J., Frystyk, H., Masinter, L., Leach, P., and T. Berners-Lee, "Hypertext Transfer Protocol -- HTTP/1.1", RFC 2616, June 1999.
- [IMAP] Crispin, M., "INTERNET MESSAGE ACCESS PROTOCOL - VERSION 4rev1", RFC 3501, March 2003.
- [IMAP-URL] Melnikov, A. and C. Newman, "IMAP URL Scheme", RFC 5092, November 2007.
- [IRI] Duerst, M. and M. Suignard, "Internationalized Resource Identifiers (IRIs)", RFC 3987, January 2005.
- [MODEL] Day, M., Rosenberg, J., and H. Sugano, "A Model for Presence and Instant Messaging", RFC 2778, February 2000.
- [POP-URL] Gellens, R., "POP URL Scheme", RFC 2384, August 1998.
- [UNICODE] The Unicode Consortium, "The Unicode Standard, Version 3.2.0", 2000.
The Unicode Standard, Version 3.2.0 is defined by The Unicode Standard, Version 3.0 (Reading, MA, Addison-Wesley, 2000. ISBN 0-201-61633-5), as amended by the Unicode Standard Annex #27: Unicode 3.1 (http://www.unicode.org/reports/tr27/) and by the Unicode Standard Annex #28: Unicode 3.2 (http://www.unicode.org/reports/tr28/).
- [URI] Berners-Lee, T., Fielding, R., and L. Masinter, "Uniform Resource Identifier (URI): Generic Syntax", STD 66, RFC 3986, January 2005.
- [UTF-8] Yergeau, F., "UTF-8, a transformation format of ISO 10646", STD 63, RFC 3629, November 2003.
- [XMPP] Saint-Andre, P., "Extensible Messaging and Presence Protocol (XMPP): Core", RFC 3920, October 2004.
- [XMPP-IM] Saint-Andre, P., "Extensible Messaging and Presence Protocol (XMPP): Instant Messaging and Presence", RFC 3921, October 2004.
Authors' Addresses ๐
and that's the squad! ๐ here's who wrote it:
Peter Saint-Andre
Cisco
EMail: psaintan@cisco.com
Alexey Melnikov
Isode Limited
EMail: Alexey.Melnikov@isode.com
๐ฆ where this page comes from
- ietf: rfc5437 2009-01
- ๐ girlified by claude-haiku-5-5 on : a language model's rewrite of the original, under its terms