RFC 6009
Sieve Email Filtering: Delivery Status Notifications and Deliver-By Extensions
Sieve Email Filtering: Delivery Status Notifications and Deliver-By Extensions π
Internet Engineering Task Force (IETF) β¨ RFC 6009 π Author: N. Freed (Oracle) π Category: Standards Track π Date: October 2010 πΈ ISSN: 2070-1721 π¦
Okay bestie, the header is the cute little intro card, so here's the tea: it's by N. Freed at Oracle, it's a Standards Track doc, and it dropped in October 2010 π. The header doesn't list anything it obsoletes or updates, so no drama there π«Ά.
Abstract π§
Okay so this doc is all about four new Sieve extensions: "envelope-dsn", "redirect-dsn", "envelope-deliverby", and "redirect-deliverby" β¨. The first two give you access to extra envelope info from the delivery status notification (DSN) SMTP extension π¬. The other two do the same for the Deliver-By SMTP extension β°. "redirect-dsn" and "redirect-deliverby" then level up Sieve's redirect action so you can control the DSN and Deliver-By parameters π .
Status of This Memo π
This is an Internet Standards Track document π.
It's a product of the Internet Engineering Task Force (IETF) and represents the consensus of the IETF community π«Ά. It got public review and was approved for publication by the Internet Engineering Steering Group (IESG) π. For more on Internet Standards, check Section 2 of RFC 5741 π.
For the current status, any errata, and how to give feedback, go to http://www.rfc-editor.org/info/rfc6009 π.
Copyright Notice Β©οΈ
Copyright (c) 2010 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 in effect on the publication date. Please read these carefully, because they spell out your rights and restrictions π. Code Components extracted from this document must include Simplified BSD License text as described in Section 4.e of the Trust Legal Provisions, and they come without warranty as described in the Simplified BSD License π₯.
Table of Contents πΊοΈ
1. Introduction . . . . . . . . . . . . . . . . . . . . . . . . . 3
2. Conventions Used in This Document . . . . . . . . . . . . . . 3
3. Capability Identifiers . . . . . . . . . . . . . . . . . . . . 4
4. Envelope-dsn Extension . . . . . . . . . . . . . . . . . . . . 4
4.1. Examples . . . . . . . . . . . . . . . . . . . . . . . . . 5
5. Envelope-deliverby Extension . . . . . . . . . . . . . . . . . 6
5.1. Examples . . . . . . . . . . . . . . . . . . . . . . . . . 7
6. redirect-dsn Extension . . . . . . . . . . . . . . . . . . . . 9
6.1. MAIL FROM Address Selection . . . . . . . . . . . . . . . 9
6.2. Example . . . . . . . . . . . . . . . . . . . . . . . . . 9
7. redirect-deliverby Extension . . . . . . . . . . . . . . . . . 10
7.1. MAIL FROM Address Selection . . . . . . . . . . . . . . . 11
7.2. Example . . . . . . . . . . . . . . . . . . . . . . . . . 11
8. Security Considerations . . . . . . . . . . . . . . . . . . . 11
9. IANA Considerations . . . . . . . . . . . . . . . . . . . . . 12
10. References . . . . . . . . . . . . . . . . . . . . . . . . . . 13
10.1. Normative References . . . . . . . . . . . . . . . . . . . 13
10.2. Informative References . . . . . . . . . . . . . . . . . . 14
Appendix A. Acknowledgements . . . . . . . . . . . . . . . . . . 15
1. Introduction πΈ
Sieve [RFC5228] is a language for filtering email messages at or around final delivery time π₯. It's built to run on either a mail client or a mail server π₯οΈ. It's especially good for mail servers where users aren't allowed to run arbitrary programs, like on black box Internet Message Access Protocol [RFC3501] servers, because it has no user-controlled loops and can't run external programs π ββοΈ.
The base Sieve spec defines the envelope extension and test for reading info from the message envelope. Only the info available in regular SMTP [RFC5321] is covered, so anything SMTP extensions add to the envelope is off limits π.
The "envelope-dsn" extension lets the envelope test read the extra envelope fields from the DSN SMTP extension in RFC 3461 [RFC3461] π¬. The "envelope-deliverby" extension does the same for the Deliver-By SMTP extension defined in [RFC2852] β°.
The base spec also defines the redirect action, which sends a message to a different address πββοΈ. Redirect only lets you specify the new recipient address. "redirect-dsn" extends redirect so you can set some fields from the DSN SMTP extension π¨. "redirect-deliverby" gives you the ability to set a delivery time limit, as specified in RFC 2852 [RFC2852] β³.
2. Conventions Used in This Document π
The key words "MUST", "MUST NOT", "REQUIRED", "SHALL", "SHALL NOT", "SHOULD", "SHOULD NOT", "RECOMMENDED", "MAY", and "OPTIONAL" in this document are to be interpreted as described in [RFC2119] π.
The terms for the parts of the Sieve language come from Section 1.1 of [RFC5228] π§©. The nature and handling of Sieve errors are described in Section 2.10.6 of [RFC5228] π¨.
This document uses the ABNF notation from [RFC5234] and refers to the notify-esmtp-value ABNF production defined in Section 4.1 of [RFC3461] π.
3. Capability Identifiers π·οΈ
The capability strings for the extensions in this document are "envelope-dsn", "redirect-dsn", "envelope-deliverby", and "redirect-deliverby" π.
4. Envelope-dsn Extension π«
Okay so the "envelope-dsn" extension doesn't add any new tests or actions π ββοΈ. Instead, it adds four values to the list of possible (case-insensitive) envelope-part strings from Section 5.4 of [RFC5228] π:
notify: Matches the notification conditions, or NOTIFY values, tied to the TO address used in the SMTP RCPT TO command that got this message delivered to this user π. More than one condition can be in effect at once, and each one gets tested separately. A match on any of them makes the test succeed π―. The syntax and semantics of the NOTIFY parameter are in Section 4.1 of RFC 3461 [RFC3461]. Right now the possible values are "NEVER", "SUCCESS", "FAILURE", and "DELAY". Heads up: "NEVER" is never combined with any other value π ββοΈ.orcpt: Matches the original recipient, or ORCPT, value tied to the TO address used in the SMTP RCPT TO command that got this message delivered to this user, with xtext encoding removed π. The syntax and semantics of the ORCPT parameter are in Section 4.2 of RFC 3461 [RFC3461].ret: Matches the return of content, or RET, value given in the SMTP MAIL FROM command π¦. The syntax and semantics of the RET parameter are in Section 4.3 of RFC 3461 [RFC3461]. The possible return of content values are "FULL" and "HDRS" π§Ύ.envid: Matches the envelope identifier, or ENVID, value in decoded form, given in the SMTP MAIL FROM command π. The syntax and semantics of the ENVID parameter are in Section 4.4 of RFC 3461 [RFC3461].
The envelope test fails unconditionally for each of these envelope-part strings if the envelope parameter doesn't exist for the current message or recipient π¬.
The envelope test's ADDRESS-PART argument assumes the tested string has the syntax of an email address. None of the new envelope parts here have address syntax, so using an ADDRESS-PART argument with them is an error π«.
The "relational" extension [RFC5231] adds a match type called ":count" π’. For the "orcpt", "ret", and "envid" envelope-parts, the count is 1 if the matching SMTP parameter is present and 0 if it isn't π. For "notify", the count equals the number of notification conditions specified, and it's 0 if the NOTIFY parameter isn't present β¨.
4.1. Examples π§
The NOTIFY envelope parameter can have multiple values, and the notify envelope-part turns them into a list. That makes it easy to check whether a given value is there, without worrying about the other values π :
require ["envelope", "envelope-dsn"];
# Check whether SUCCESS notifications were requested,
# irrespective of any other requests that were made
if envelope "notify" "SUCCESS"
{
# do whatever
}
Checking whether a given request is the only one is a little trickier, though π€:
require ["envelope", "envelope-dsn", "relational",
"comparator-i;ascii-numeric"];
# Check whether only FAILURE notifications were requested
if allof ( envelope "notify" "FAILURE",
envelope :comparator "i;ascii-numeric"
:count "eq" "notify" "1"
)
{
# do whatever
}
The orcpt envelope-part always includes an address type indicator prefix along with the address, and you have to account for that in any tests π«Ά:
require ["envelope", "envelope-dsn"];
# See if the orcpt is an RFC822 address in the example.com
# domain
if envelope :matches "orcpt" "rfc822;*@example.com"
{
# do whatever
}
To be continued... ππ
5. Envelope-deliverby Extension β¨
okay bestie, the envelope-deliverby extension doesn't add any new tests or actions π it just adds four new values to the list of envelope-part strings (case-insensitive, so no stress) from Section 5.4 of [RFC5228], plus an optional :zone tagged argument. so the usage for envelope now looks like this:
Usage: envelope [COMPARATOR] [ADDRESS-PART]
[MATCH-TYPE] [:zone <time-zone: string>]
<envelope-part: string-list>
<key-list: string-list>
these new envelope parts line up with the new MAIL FROM parameters from Section 4 of [RFC2852] π there are four of them:
"bytimeabsolute": matches the current value of the initial integer part of the Deliver-By extension's BY parameter on the SMTP MAIL FROM command, converted into an absolute time in restricted ISO 8601 format. that format is the date-time ABNF production from [RFC3339], Section 5.6, with two extra rules: the letters "T" and "Z" MUST be in upper case, and a time zone offset of zero MUST be represented by "Z" and not "+00:00". π°οΈ"bytimerelative": matches the current value of the initial integer part of the Deliver-By extension's BY parameter specified in the SMTP MAIL FROM command. β³"bymode": matches a string computed from the by-mode part of the Deliver-By extension's BY parameter. the possible values are"notify"and"return", which correspond to the BY parameter mode specifier characters "N" and "R", respectively. π¬"bytrace": matches the trace modifier computed from the by-trace modifier on the Deliver-By extension's BY parameter. the possible values are"trace"and""(the empty string). those correspond to the presence or absence of the by-trace "T" modifier, respectively. π
the envelope test fails unconditionally for each of these envelope-part strings if the BY SMTP MAIL FROM parameter doesn't exist for the current message or recipient. π
the new :zone argument specifies a time zone offset string that any "bytimeabsolute" value gets shifted to before testing. :zone has zero effect on the other envelope-parts, only bytimeabsolute πΈ the value of the time zone offset string MUST be an offset relative to UTC, with this syntax:
time-zone = ( "+" / "-" ) 4DIGIT
the "+" or "-" tells you whether the time-of-day is ahead of (aka east of) or behind (aka west of) UTC. the first two digits are the number of hours difference from Universal Time, and the last two are the number of minutes difference. this matches the [RFC5322] format for time zone offsets, NOT the ISO 8601 format, so be careful with that one π the local time zone MUST be used for bytimeabsolute if the :zone argument is omitted.
the envelope test's ADDRESS-PART argument assumes the string being tested looks like an email address. none of the new envelope parts have address syntax, so it's an error to pair an ADDRESS-PART argument with any of these new envelope parts π«
the "relational" extension [RFC5231] adds a match type called ":count". for an envelope test using the envelope-parts "bytime", "bymode", and "bytrace", the count is 1 if the BY parameter is present and 0 otherwise. π’
it's really important to know that the Deliver-By by-time gets decremented as the message moves through the transport infrastructure π so you can't figure out what the originator originally set it to. the only thing you can find out is how much time is left at the exact moment the sieve runs. also, bytimerelative values can be negative, so you either need extra checks or a comparator that can handle signed integers (unlike i;ascii-numeric) π
5.1. Examples
as I said above, this extension doesn't give you access to the originator's initial by-time setting, because that info just isn't part of the envelope. BUT you can still check whether the message got delivered in time! π notice the extra check for negative values:
require ["envelope", "envelope-deliverby", "relational",
"comparator-i;ascii-numeric"];
# Check to see if this message didn't make it in the time allotted by
# the originator.
if anyof (envelope :contains "bytimerelative" "-",
envelope :value "eq" :comparator "i;ascii-numeric"
"bytimerelative" "0")
{
# do whatever
}
you can do this even more simply if the date [RFC5260] and variables [RFC5229] extensions are available π§
require ["envelope", "envelope-deliverby", "relational", "date",
"variables"];
# Check to see if this message didn't make it in the time allotted by
# the originator.
if currentdate :matches "iso8601" "*" {
set "cdate" "${0}";
if envelope :value "ge" "bytimeabsolute" "${cdate}" {
# do whatever
}
}
there's no need to force a particular time zone here, since both currentdate and the bytimeabsolute value are required to default to the local time zone. if your action depends on the by-time being in a specific zone, you can use :zone instead π
require ["envelope", "envelope-deliverby", "relational", "date",
"variables"];
# If the message didn't make it in time, file it according to when it
# should have been received
if envelope :matches :zone "+0000" "bytimeabsolute" "*T*:*:*" {
set "bdate" "${0}";
set "bhour" "${2}";
if currentdate :zone "+0000" :value "lt" "iso8601" "${bdate}")
fileinto "missed-${bhour}";
}
}
6. redirect-dsn Extension
okay so the redirect-dsn extension doesn't add any new tests or actions either π· instead it gives the redirect action from Section 4.2 of [RFC5228] two new arguments, NOTIFY and RET. the usage for redirect becomes:
Usage: redirect [:notify "value"] [:ret "FULL"|"HDRS"]
<address: string>
the syntax for NOTIFY and RET is:
NOTIFY = ":notify" notify-value
notify-value = DQUOTE ("NEVER" / notify-esmtp-list) DQUOTE
notify-esmtp-list = notify-list-element *("," notify-list-element)
RET = ":ret" ret-value
ret-value = DQUOTE ("FULL" / "HDRS") DQUOTE
the notify-list-element ABNF production is defined in Section 4.1 of [RFC3461] π
when these arguments get specified, they set the matching NOTIFY ESMTP RCPT TO and RET ESMTP MAIL FROM parameters, respectively π they're only honored if the delivery status notification (DSN) ESMTP extension is available. if the DSN extension isn't available, these arguments MUST be ignored and MUST NOT cause an error. no drama, just vibes π«Ά
6.1. MAIL FROM Address Selection
[RFC5228] doesn't require any particular envelope sender address to be linked to redirected messages. BUT redirect-dsn isn't very useful if nobody knows where the delivery status notifications are supposed to go π€·ββοΈ so when either :notify or :ret is specified and the envelope sender address isn't empty, implementations MUST set the envelope sender address to the address of the sieve owner. π
6.2. Example
one iconic use of :notify on redirect is combining the copy extension [RFC3894] with the ability to suppress nondelivery notifications. that gives you a private copy of selected messages with no side effects or error notifications π€«
require ["copy", "redirect-dsn"];
# Make a private copy of messages from user@example.com
if address "from" "user@example.com"
{
redirect :copy :notify "NEVER" "elsewhere@example.com";
}
7. redirect-deliverby Extension
the redirect-deliverby extension doesn't define any new tests or actions π¦ it adds three new arguments to the redirect action from Section 4.2 of [RFC5228]: BYTIME, BYMODE, and BYTRACE. the usage for redirect is now:
Usage: redirect [:bytimerelative <rlimit: number> /
:bytimeabsolute <alimit:string>
[:bymode "notify"|"return"] [:bytrace]]
<address: string>
:bytimerelative sets how many seconds the message should be delivered within. negative values aren't allowed here, and it shouldn't be necessary to specify them in this context β±οΈ :bytimeabsolute sets an absolute time limit on delivery. the limit is written in the restricted ISO 8601 format from the date-time ABNF production in [RFC3339].
:bymode decides whether a notification gets sent or the message just gets returned if the time limit is exceeded. if :bymode isn't specified, the default is "return". :bytrace, if you include it, turns on message tracing π
the semantics of delivery time limits and these parameters are covered at length in [RFC2852], so go there if you want the deep dive π
it's an error to specify either :bymode or :bytrace without also specifying either :bytimeabsolute or :bytimerelative π ββοΈ
when these arguments are specified, they're used to build the matching BY ESMTP MAIL FROM parameter. the :bytimeabsolute or :bytimerelative value becomes the by-time, :bymode becomes the by-mode value, and :bytrace sets the by-trace modifier. if the Deliver-By extension is unavailable, the handling of the redirected message MUST conform to the semantics specified in [RFC2852], Section 4.1.4 for relaying to a server that does not support the Deliver-By SMTP extension. π«
7.1. MAIL FROM Address Selection
just like before, [RFC5228] doesn't require any particular envelope sender address for redirected messages. and the redirect-deliverby extension, same as redirect-dsn, isn't terribly useful if nobody knows where the delivery status notifications go π so when either :bytimeabsolute or :bytimerelative is specified and the envelope sender address isn't empty, implementations MUST set the envelope sender address to the address of the sieve owner. π
7.2. Example
the obvious use of "redirect-deliverby" is putting a time limit on delivery attempts for a redirected message β°
require ["copy", "redirect-deliverby"];
# Send a copy to my cell phone, time out after 10 minutes
if address "from" "user@example.com"
{
redirect :copy :bytimerelative 600 "cellphone@example.com";
}
you can also build limits based on a particular time of day π
require ["copy", "redirect-deliverby", "date", "variables",
"relational", "comparator-i;ascii-numeric"];
# Send a copy to my cell phone to be delivered before 10PM
if currentdate :value "lt"
:comparator "i;ascii-numeric" "hour" "22"
{
if currentdate :matches "date" "*" {set "date" "${0}";}
if currentdate :matches "zone" "*" {set "zone" "${0}";}
redirect :copy :bytimeabsolute "${date}T20:00:00${zone}"
:bymode "return" "cellphone@example.com";
}
8. Security Considerations π
okay so the envelope-dsn and envelope-deliverby extensions give you access to extra message envelope info π this is not believed to raise any additional security issues beyond the ones already there for the Sieve "envelope" test, so that's a relief π
The redirect-dsn extension lets you specify the NOTIFY parameter for the delivery status notification π¬ and that can cause notification messages to get generated that otherwise wouldn't be, especially if you need notification even when delivery succeeds β bestie, sites that limit who can request success notifications also need to limit who can request them through redirect-dsn π«
Same energy for redirect-deliverby π°οΈ it controls how long the transport infrastructure keeps trying to deliver a message before it gives up, and that could lead to extra notification messages being generated π The underlying Deliver-By extension does have a minimum by-time limit, but sites may wish to impose additional limits on the minimum by-time allowed in a redirect action π§±
All of the security considerations given in the base Sieve specification also apply to this extension. Don't skip the base spec, it's still in play π«Ά
9. IANA Considerations π
The following template specifies the IANA registration of the Sieve extensions specified in this document π
To: iana@iana.org
Subject: Registration of new Sieve extensions
Capability name: envelope-dsn
Description: The "envelope-dsn" extension extends the envelope
test to allow checking of information associated
with the DSN ESMTP extension defined in RFC 3461.
RFC number: RFC 6009
Contact address: Sieve discussion list <sieve@ietf.org>
Capability name: envelope-deliverby
Description: The "envelope-deliverby" extension extends the
envelope test to allow checking of information
associated with the Deliver-By ESMTP extension
defined in RFC 2852.
RFC number: RFC 6009
Contact address: Sieve discussion list <sieve@ietf.org>
Capability name: redirect-dsn
Description: The "redirect-dsn" extension extends the redirect
action to allow specification of the NOTIFY and
RET ESMTP parameters associated with the DSN SMTP
extension defined in RFC 3461.
RFC number: RFC 6009
Contact address: Sieve discussion list <sieve@ietf.org>
Capability name: redirect-deliverby
Description: The "redirect-deliverby" extension extends the
redirect action to allow specification of the BY
ESMTP parameter associated with the Deliver-By SMTP
extension defined in RFC 2852.
RFC number: RFC 6009
Contact address: Sieve discussion list <sieve@ietf.org>
This information has been added to the list of Sieve extensions available from http://www.iana.org. β¨
10. References π
10.1. Normative References πͺ
[RFC2119] Bradner, S., "Key words for use in RFCs to Indicate
Requirement Levels", BCP 14, RFC 2119, March 1997.
[RFC2852] Newman, D., "Deliver By SMTP Service Extension", RFC 2852,
June 2000.
[RFC3339] Klyne, G., Ed. and C. Newman, "Date and Time on the
Internet: Timestamps", RFC 3339, July 2002.
[RFC3461] Moore, K., "Simple Mail Transfer Protocol (SMTP) Service
Extension for Delivery Status Notifications (DSNs)",
RFC 3461, January 2003.
[RFC5228] Guenther, P. and T. Showalter, "Sieve: An Email Filtering
Language", RFC 5228, January 2008.
[RFC5231] Segmuller, W. and B. Leiba, "Sieve Email Filtering:
Relational Extension", RFC 5231, January 2008.
[RFC5234] Crocker, D. and P. Overell, "Augmented BNF for Syntax
Specifications: ABNF", STD 68, RFC 5234, January 2008.
[RFC5321] Klensin, J., "Simple Mail Transfer Protocol", RFC 5321,
October 2008.
[RFC5322] Resnick, P., Ed., "Internet Message Format", RFC 5322,
October 2008.
10.2. Informative References π¦
[RFC3501] Crispin, M., "INTERNET MESSAGE ACCESS PROTOCOL - VERSION
4rev1", RFC 3501, March 2003.
[RFC3894] Degener, J., "Sieve Extension: Copying Without Side
Effects", RFC 3894, October 2004.
[RFC5229] Homme, K., "Sieve Email Filtering: Variables Extension",
RFC 5229, January 2008.
[RFC5260] Freed, N., "Sieve Email Filtering: Date and Index
Extensions", RFC 5260, July 2008.
Appendix A. Acknowledgements π«Ά
Cyrus Daboo, Derek Diget, Philip Guenther, Arnt Gulbrandsen, Tero Kivinen, Barry Leiba, Andrew McKeon, Alexey Melnikov, Chris Newman, Aaron Stone, and Alexandros Vellis provided helpful suggestions and corrections. Iconic group of people, thank you all π
Author's Address ποΈ
Ned Freed
Oracle
800 Royal Oaks
Monrovia, CA 91016-6347
USA
EMail: ned.freed@mrochek.com
And that's the whole thing, bestie ππ periodt π
π¦ where this page comes from
- ietf: rfc6009 2010-10
- π girlified by claude-haiku-5-5 on : a language model's rewrite of the original, under its terms