RFC 7889 PROPOSED STANDARD EMAIL · IMAP

The IMAP APPENDLIMIT Extension

An IMAP extension that tells clients the largest message a server will accept before they upload it.

On rfc-editor.org ↗
PUBLISHED
May 2016
AUTHORS
J. SrimushnamBoovaraghamoorthy, N. Bisht
STREAM
IETF
CAPABILITY NAME
APPENDLIMIT
REJECTION RESPONSE CODE
TOOBIG
LIMIT UNIT
octets
LIMIT OF 0
No APPEND accepted
NO LIMIT FOR A MAILBOX
NIL
DOI
10.17487/RFC7889
ERRATA
Reported errata

RFC text

Contents
Original text · RFC Editor View on rfc-editor.org ↗
Internet Engineering Task Force (IETF)    J. SrimushnamBoovaraghamoorthy
Request for Comments: 7889                                      N. Bisht
Category: Standards Track                    Samsung Electronics America
ISSN: 2070-1721                                                 May 2016


                     The IMAP APPENDLIMIT Extension

Abstract

   This document defines an extension to the IMAP service whereby a
   server can inform the client about maximum message upload sizes,
   allowing the client to avoid sending APPEND commands that will fail
   because the messages are too large.

Status of This Memo

   This is an Internet Standards Track document.

   This document is a product of the Internet Engineering Task Force
   (IETF).  It represents the consensus of the IETF community.  It has
   received public review and has been approved for publication by the
   Internet Engineering Steering Group (IESG).  Further information on
   Internet Standards is available in Section 2 of RFC 5741.

   Information about the current status of this document, any errata,
   and how to provide feedback on it may be obtained at
   http://www.rfc-editor.org/info/rfc7889.

Copyright Notice

   Copyright (c) 2016 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) in effect on the date of
   publication of this document.  Please review these documents
   carefully, as they describe your rights and restrictions with respect
   to this document.  Code Components extracted from this document must
   include Simplified BSD License text as described in Section 4.e of
   the Trust Legal Provisions and are provided without warranty as
   described in the Simplified BSD License.

Table of Contents

   1.  Introduction  . . . . . . . . . . . . . . . . . . . . . . . .   2
     1.1.  Conventions . . . . . . . . . . . . . . . . . . . . . . .   2
   2.  APPENDLIMIT Extension . . . . . . . . . . . . . . . . . . . .   3
   3.  Mailbox-Specific APPENDLIMIT  . . . . . . . . . . . . . . . .   3
     3.1.  STATUS Response to the STATUS Command . . . . . . . . . .   4
     3.2.  STATUS Response to the LIST Command . . . . . . . . . . .   4
     3.3.  APPENDLIMIT Behavior  . . . . . . . . . . . . . . . . . .   4
   4.  APPEND Response . . . . . . . . . . . . . . . . . . . . . . .   4
   5.  Formal Syntax . . . . . . . . . . . . . . . . . . . . . . . .   5
   6.  Security Considerations . . . . . . . . . . . . . . . . . . .   5
   7.  IANA Considerations . . . . . . . . . . . . . . . . . . . . .   5
   8.  References  . . . . . . . . . . . . . . . . . . . . . . . . .   6
     8.1.  Normative References  . . . . . . . . . . . . . . . . . .   6
     8.2.  Informative References  . . . . . . . . . . . . . . . . .   6
   Acknowledgements  . . . . . . . . . . . . . . . . . . . . . . . .   7
   Authors' Addresses  . . . . . . . . . . . . . . . . . . . . . . .   7

1.  Introduction

   Some IMAP servers have limits for message upload size, and those
   limits are not published to the email client.  When the email client
   APPENDs a message with huge attachments, using non-synchronizing
   literals, the APPEND fails because of the upload limit, but the
   client has already sent the message data anyway.  This results in
   unnecessary resource usage.  Especially in the mobile device
   environment, appending a message with huge attachments consumes
   device resources like device battery power and mobile data.

   The IMAP APPENDLIMIT extension provides the ability to advertise a
   maximum upload size allowed by the IMAP server, so that the email
   client knows the size limitation beforehand.  By implementing this
   extension, IMAP server-side processing of huge attachments above the
   maximum upload size can be avoided.

1.1.  Conventions

   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].

   In examples, "C:" and "S:" indicate lines sent by the client and
   server, respectively.  If a single "C:" or "S:" label applies to
   multiple lines, then the line breaks between those lines are for
   editorial clarity only and are not part of the actual protocol
   exchange.

2.  APPENDLIMIT Extension

   An IMAP server that supports the APPENDLIMIT extension advertises
   this by including the name APPENDLIMIT in its capability list in the
   authenticated state.  The server may also advertise this extension
   before the user has logged in.  If this capability is omitted, no
   information is conveyed about the server's fixed maximum size for
   mail uploads.  An IMAP server can publish the APPENDLIMIT capability
   in two formats.

   (a) APPENDLIMIT=<number>

   This indicates that the IMAP server has the same upload limit for all
   mailboxes.  The following example demonstrates the APPENDLIMIT
   capability with the same upload limit for all mailboxes.

   C: t1 CAPABILITY
   S: * CAPABILITY IMAP4rev1 ID APPENDLIMIT=257890
   S: t1 OK foo

   (b) APPENDLIMIT

   The APPENDLIMIT capability without any value indicates that the IMAP
   server supports this extension, and that the client will need to
   discover upload limits for each mailbox, as they might differ from
   mailbox to mailbox.  The following example demonstrates the
   APPENDLIMIT capability without any value.

   C: t1 CAPABILITY
   S: * CAPABILITY IMAP4rev1 ID APPENDLIMIT
   S: t1 OK foo

   In this case, the client can get an APPENDLIMIT value by either
   issuing a STATUS or a LIST command.

   An IMAP client implementing this extension should be able to parse
   both mailbox-specific and global APPENDLIMIT responses.  By looking
   at the upload size advertised by the IMAP server, a client can avoid
   trying to APPEND mail more than the advertised limit.

3.  Mailbox-Specific APPENDLIMIT

   An IMAP server can have mailbox-specific APPENDLIMIT values that will
   not be advertised as part of the CAPABILITY response.  The IMAP
   server can publish specific values for each mailbox, and it can
   publish "NIL" for a mailbox to convey that there is no APPENDLIMIT
   for that mailbox.  The following subsections describe the changes to
   the STATUS and LIST commands in support of this situation.

3.1.  STATUS Response to the STATUS Command

   A new attribute APPENDLIMIT is added to get the limit set by the
   server for a mailbox as part of a STATUS command.  An IMAP client
   should issue a STATUS command with an APPENDLIMIT item to get the
   mailbox-specific upload value.  The following example demonstrates
   its usage.

   C: t1 STATUS INBOX (APPENDLIMIT)
   S: * STATUS INBOX (APPENDLIMIT 257890)
   S: t1 OK STATUS completed

   In the above example, APPENDLIMIT represents the maximum upload size
   for INBOX.

3.2.  STATUS Response to the LIST Command

   If the server advertises the LIST-STATUS capability [RFC5819], the
   client can issue a LIST command in combination with the STATUS return
   option to get the mailbox-specific upload value.  The following
   example demonstrates its usage.

   C: t1 LIST "" % RETURN (STATUS (APPENDLIMIT))
   S: * LIST () "."  "INBOX"
   S: * STATUS "INBOX" (APPENDLIMIT 257890)
   S: t1 OK List completed.

   The IMAP server MUST recognize the APPENDLIMIT attribute and include
   an appropriate STATUS response for each matching mailbox.  Refer to
   Section 5 for the syntax.

   If the server does not support the STATUS return option on the LIST
   command, then the client should use the STATUS command instead.

3.3.  APPENDLIMIT Behavior

   Computing the APPENDLIMIT should be fast and should not take Access
   Control Lists (ACLs), quotas, or other such information into account.
   The APPENDLIMIT specifies one part of the policy, but an APPEND
   command can still fail due to issues related to ACLs and quotas, even
   if the message being appended is smaller than the APPENDLIMIT.

4.  APPEND Response

   If a client uploads a message that exceeds the maximum upload size
   set for that mailbox, then the server SHALL reject the APPEND command
   with a tagged TOOBIG response code.  Refer to Section 4 of [RFC4469]
   for various APPEND response codes and their handling.

   A client SHOULD avoid use of non-synchronizing literals [RFC7888]
   when the maximum upload size supported by the IMAP server is unknown.
   Refer to Section 4.2.2.3 of [RFC4549] for usage of non-synchronizing
   literals and its risk for disconnected IMAP clients.

5.  Formal Syntax

   The following syntax specification uses the Augmented Backus-Naur
   Form (ABNF) notation as specified in [RFC5234] including the core
   rules in Appendix B.1 of that document.  [RFC3501] defines the non-
   terminals "capability" and "status-att", and [RFC4466] defines
   "status-att-val".

   All alphabetic characters are case insensitive.  The use of uppercase
   or lowercase characters to define token strings is for editorial
   clarity only.  Implementations MUST accept these strings in a case-
   insensitive fashion.

   capability =/ "APPENDLIMIT" ["=" number]
               ;; capability is defined in RFC 3501

   status-att =/ "APPENDLIMIT"
               ;; status-att is defined in RFC 3501

   status-att-val =/ "APPENDLIMIT" SP (number / nil)
                   ;; status-att-val is defined in RFC 4466


   The number indicates the fixed maximum message size in octets that
   the server will accept.  An APPENDLIMIT number of 0 indicates the
   server will not accept any APPEND commands at all for the affected
   mailboxes.

6.  Security Considerations

   This extension provides additional information that cooperative
   clients can use as an optimization and does not introduce new
   security concerns.  This extension does not address abusive clients
   that intend to consume server resources, and servers will still have
   to take action to disconnect and/or restrict access to clients that
   exhibit abusive behavior.

7.  IANA Considerations

   IANA has added "APPENDLIMIT" to the "IMAP Capabilities" registry,
   using this document as its reference.

8.  References

8.1.  Normative References

   [RFC2119]  Bradner, S., "Key words for use in RFCs to Indicate
              Requirement Levels", BCP 14, RFC 2119,
              DOI 10.17487/RFC2119, March 1997,
              <http://www.rfc-editor.org/info/rfc2119>.

   [RFC3501]  Crispin, M., "INTERNET MESSAGE ACCESS PROTOCOL - VERSION
              4rev1", RFC 3501, DOI 10.17487/RFC3501, March 2003,
              <http://www.rfc-editor.org/info/rfc3501>.

   [RFC4466]  Melnikov, A. and C. Daboo, "Collected Extensions to IMAP4
              ABNF", RFC 4466, DOI 10.17487/RFC4466, April 2006,
              <http://www.rfc-editor.org/info/rfc4466>.

   [RFC4469]  Resnick, P., "Internet Message Access Protocol (IMAP)
              CATENATE Extension", RFC 4469, DOI 10.17487/RFC4469, April
              2006, <http://www.rfc-editor.org/info/rfc4469>.

   [RFC5234]  Crocker, D., Ed. and P. Overell, "Augmented BNF for Syntax
              Specifications: ABNF", STD 68, RFC 5234,
              DOI 10.17487/RFC5234, January 2008,
              <http://www.rfc-editor.org/info/rfc5234>.

   [RFC5819]  Melnikov, A. and T. Sirainen, "IMAP4 Extension for
              Returning STATUS Information in Extended LIST", RFC 5819,
              DOI 10.17487/RFC5819, March 2010,
              <http://www.rfc-editor.org/info/rfc5819>.

   [RFC7888]  Melnikov, A., Ed., "IMAP4 Non-synchronizing Literals",
              RFC 7888, DOI 10.17487/RFC7888, May 2016,
              <http://www.rfc-editor.org/info/rfc7888>.

8.2.  Informative References

   [RFC4549]  Melnikov, A., Ed., "Synchronization Operations for
              Disconnected IMAP4 Clients", RFC 4549,
              DOI 10.17487/RFC4549, June 2006,
              <http://www.rfc-editor.org/info/rfc4549>.

Acknowledgements

   Thanks to Alexey Melnikov, Dave Cridland, Adrien de Croy, Michael
   M. Slusarz, Timo Sirainen, Chris Newman, Pete Maclean, Jamie
   Nicolson, Stu Brandt, Bron Gondwana, Arnt Gulbrandsen, Cyrus Daboo,
   Jan Kundrat, Brandon Long, and Barry Leiba for providing valuable
   comments.

Authors' Addresses

   Jayantheesh SrimushnamBoovaraghamoorthy
   Samsung Electronics America
   685 US Highway 202/206
   Bridgewater, NJ  08807
   United States

   Email: jayantheesh.sb@gmail.com


   Narendra Singh Bisht
   Samsung Electronics America
   685 US Highway 202/206
   Bridgewater, NJ  08807
   United States

   Email: narendrasingh.bisht@gmail.com

AI ELI5

On this page
PROBLEMIMAP servers often limit upload size but do not tell the client, so a client can send a huge message with a non-synchronizing literal and only learn afterwards that the APPEND failed.
MECHANISMThe server advertises an APPENDLIMIT capability, either with one value for all mailboxes or without a value, in which case the client reads per-mailbox limits through STATUS or LIST.
WHY IT MATTERSClients can skip uploads that would be refused, which saves battery and mobile data. Oversized APPENDs are rejected with a TOOBIG response code.

§1The Problem and the Idea

Some IMAP servers limit message upload size and do not publish the limit. If a client APPENDs a message with huge attachments using non-synchronizing literals, the APPEND fails because of the limit, but the client has already sent the data. That wastes resources, especially on mobile devices where it consumes battery power and mobile data.

The APPENDLIMIT extension lets the server advertise the maximum upload size so the client knows the limit beforehand, and the server can avoid processing attachments above it.

Without the sign, you carry a giant box all the way and only then hear 'too big'. The extension puts up the sign.

§2Advertising the Capability

A server that supports the extension includes APPENDLIMIT in its capability list in the authenticated state, and may also advertise it before login. If the capability is omitted, nothing is conveyed about a fixed maximum size. It comes in two forms.

  • APPENDLIMIT=<number> means the same upload limit applies to all mailboxes, for example S: * CAPABILITY IMAP4rev1 ID APPENDLIMIT=257890.
  • APPENDLIMIT with no value means the extension is supported but limits can differ per mailbox, so the client must discover each one with a STATUS or LIST command.

A client implementing the extension should parse both mailbox-specific and global responses, and avoid trying to APPEND mail larger than the advertised limit.

The sign at the door either says one size for every counter, or says 'ask at each counter'.

§3Per-Mailbox Limits with STATUS and LIST

A server can have mailbox-specific values that are not part of the CAPABILITY response. It can publish a value for each mailbox, or NIL to say that mailbox has no limit. A new STATUS attribute, APPENDLIMIT, retrieves it: C: t1 STATUS INBOX (APPENDLIMIT) is answered by S: * STATUS INBOX (APPENDLIMIT 257890).

If the server advertises LIST-STATUS (RFC 5819), the client can ask for it with LIST "" % RETURN (STATUS (APPENDLIMIT)), and the server MUST recognize the attribute and include a STATUS response for each matching mailbox. If the server does not support the STATUS return option on LIST, the client should use the STATUS command.

Computing the limit should be fast and should not take Access Control Lists (ACLs), quotas or similar information into account. The limit is only part of the policy, so an APPEND smaller than the limit can still fail because of ACLs or quotas.

You can ask each counter its own size limit. A counter may say 'no limit'. Even a small box can still be turned away for other reasons.

PER-MAILBOX LIMIT VIA STATUS (EXAMPLE FROM RFC 7889)
ClientServer
  1. t1 STATUS INBOX (APPENDLIMIT)Ask for the upload limit of one mailbox.
  2. * STATUS INBOX (APPENDLIMIT 257890)The limit for INBOX.
  3. t1 OK STATUS completed

§4Rejecting Oversized Messages

If a client uploads a message larger than the limit for that mailbox, the server SHALL reject the APPEND with a tagged TOOBIG response code. Section 4 of RFC 4469 covers APPEND response codes and their handling.

A client SHOULD avoid non-synchronizing literals (RFC 7888) when the server's maximum upload size is unknown. Section 4.2.2.3 of RFC 4549 describes their use and their risk for disconnected IMAP clients.

If you bring a too-big box anyway, the clerk says 'TOOBIG'. When you do not know the limit, do not dump the box on the counter before asking.

§5Formal Syntax

The syntax uses ABNF (RFC 5234) and builds on non-terminals from RFC 3501 (capability, status-att) and RFC 4466 (status-att-val). Strings are case insensitive, and implementations MUST accept them that way.

The additions are capability =/ "APPENDLIMIT" ["=" number], status-att =/ "APPENDLIMIT" and status-att-val =/ "APPENDLIMIT" SP (number / nil). The number is the fixed maximum message size in octets. A value of 0 means the server will not accept any APPEND commands for the affected mailboxes.

The grammar is the rule for how to write the question and answer so both sides read them the same way. Zero means 'nothing is accepted here'.

§6Security and IANA Notes

The extension gives cooperative clients extra information as an optimization and introduces no new security concerns. It does not address abusive clients that try to consume server resources, so servers still have to disconnect or restrict access to clients that behave abusively.

IANA has added APPENDLIMIT to the IMAP Capabilities registry, with this document as the reference.

The sign only helps people who read it. Someone set on causing trouble still has to be shown the door.

§7References