Skip to main content

The IMAP Move Extension

The information below is for an old version of the document.
Document Type
This is an older version of an Internet-Draft that was ultimately published as RFC 6851.
Authors Arnt Gulbrandsen , Ned Freed
Last updated 2012-11-21 (Latest revision 2012-10-20)
Replaces draft-gulbrandsen-imap-move
RFC stream Internet Engineering Task Force (IETF)
Additional resources Mailing list discussion
Stream WG state Submitted to IESG for Publication
Document shepherd Alexey Melnikov
Shepherd write-up Show Last changed 2012-11-07
IESG IESG state Waiting for AD Go-Ahead::Revised I-D Needed
Consensus boilerplate Unknown
Telechat date (None)
Responsible AD Barry Leiba
Send notices to,
Network Working Group                                     A. Gulbrandsen
Intended status: Standards Track                                N. Freed
Expires: April 23, 2013                                           Oracle
                                                        October 20, 2012

                        The IMAP Move Extension


   This document defines an IMAP extension consisting of two new
   commands, MOVE and UID MOVE, that are used to move messages from one
   mailbox to another.

Status of this Memo

   This Internet-Draft is submitted in full conformance with the
   provisions of BCP 78 and BCP 79.

   Internet-Drafts are working documents of the Internet Engineering
   Task Force (IETF).  Note that other groups may also distribute
   working documents as Internet-Drafts.  The list of current Internet-
   Drafts is at

   Internet-Drafts are draft documents valid for a maximum of six months
   and may be updated, replaced, or obsoleted by other documents at any
   time.  It is inappropriate to use Internet-Drafts as reference
   material or to cite them other than as "work in progress."

   This Internet-Draft will expire on April 23, 2013.

Copyright Notice

   Copyright (c) 2012 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
   ( 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.

Gulbrandsen & Freed      Expires April 23, 2013                 [Page 1]
Internet-Draft                  IMAP Move                   October 2012

1.  Introduction

   This document defines an IMAP [RFC3501] extension to facilitate
   moving messages from one mailbox to another.  This is accomplished by
   defining a new MOVE command and extending the UID command to allow

   A move function is not provided in the base IMAP specification, so
   clients have instead had to use a combination of the UID STORE, UID
   COPY and EXPUNGE commands to perform this very common operation.
   This has meant needing to cope with partial failures and side effects
   that can occur when multiple commands are involved.

2.  Conventions Used in This Document

   The key words "MUST", "MUST NOT", "REQUIRED", "SHALL", "SHALL NOT",
   document are to be interpreted as described in [RFC2119].

   Formal syntax is specified using ABNF [RFC5234].

   Example lines prefaced by "C:" are sent by the client and ones
   prefaced by "S:" by the server.


3.1.  MOVE Command

   Arguments: sequence set

       mailbox name

   Responses: no specific responses for this command

   Result: OK - move completed

           NO - move error: can't move those messages or to that name

           BAD - command unknown or arguments invalid

3.2.  UID MOVE Command

   This extends the first form of the UID command (see [RFC3501],
   Section 6.4.8) to add the MOVE command, defined above, as a valid

Gulbrandsen & Freed      Expires April 23, 2013                 [Page 2]
Internet-Draft                  IMAP Move                   October 2012

3.3.  Semantics of MOVE and UID MOVE

   The MOVE command takes two arguments: a message set (sequence numbers
   for MOVE, UIDs for UID MOVE) and a named mailbox.  Each message
   included in the set is moved, rather than copied, from the selected
   (source) mailbox to the named (target) mailbox.

   This means that a new message is created in the target mailbox, with
   a new UID, the original message is removed from the source mailbox,
   and it appears to the client as a single action.  This has the same
   effect for each message as this sequence:

   1.  [UID] COPY



   Each message SHOULD either be moved or unaffected.  The server MUST
   NOT leave a message in neither mailbox, and SHOULD NOT leave a
   message in both mailboxes afterwards, even if the server returns a
   tagged NO response.  Note that these restrictions only apply to
   individual messages and not to the command as a whole, which can fail
   partway through.

   Because of the similarity of MOVE to COPY, extensions that affect
   COPY affect MOVE in the same way.  Response codes such TRYCREATE (see
   [RFC3501] Section 6.4.7), as well as those defined by extensions, are
   sent as appropriate.  See Section 4 for more information about how
   MOVE interacts with other IMAP extensions.

   An example:

       C: a UID MOVE 42:69 forble
       S: * OK [COPYUID 432432 42:69 1202:1229]
       S: * 22 EXPUNGE
       S: (more expunges)
       S: a OK Done

   Note that the server may send EXPUNGEs for other messages as well, if
   any happen to have been expunged at the same time; this is normal
   IMAP operation.

   Implementers will need to read [RFC4315] to understand what UID
   EXPUNGE does, though full implementation of [RFC4315] is not

   Note that moving a message to the currently selected mailbox (that

Gulbrandsen & Freed      Expires April 23, 2013                 [Page 3]
Internet-Draft                  IMAP Move                   October 2012

   is, where the source and target mailboxes are the same) is allowed
   when copying the message to the currently selected mailbox is

   The server may send EXPUNGE (or VANISHED) messages before the tagged
   response, so the client cannot safely send more commands with message
   sequence number arguments while the server is processing MOVE.  The
   UID MOVE command does not have this limitation.

   Both MOVE and UID MOVE can be pipelined, however, pipelined MOVE and
   UID MOVE commands MUST NOT specify overlapping sets of messages.

4.  Interaction with other extensions

   This section describes how MOVE interacts with some other IMAP

4.1.  RFC 2087, QUOTA

   The QUOTA extension (defined by [RFC2087]) may interact with MOVE, on
   some servers, in the sense that a MOVE command may succeed where COPY
   would cause a quota overrun.  This may be user-visible, but should
   not be MUA-visible.

4.2.  RFC 4314, ACL

   The ACL rights [RFC4314] required for the UID MOVE are the union of
   the ACL rights required for UID STORE, UID COPY and UID EXPUNGE.

4.3.  RFC 4315, UIDPLUS

   Servers supporting UIDPLUS [RFC4315] MUST send COPYUID in response to
   a UID MOVE command.

   Servers implementing UIDPLUS are also advised to send the COPYUID
   response code in an untagged OK before sending EXPUNGE for moved
   messages.  (Sending it in the tagged OK, as described in the UIDPLUS
   specification, means that clients first receive an EXPUNGE for a
   message and afterwards COPYUID for the same message.  It can be
   unnecessarily difficult to process that usefully.)

4.4.  RFC 5162, QRESYNC

   The QRESYNC extension [RFC5162] directs the server to send VANISHED
   rather than EXPUNGE in response to the UID EXPUNGE command.  The same
   requirement applies to the UID MOVE command.

Gulbrandsen & Freed      Expires April 23, 2013                 [Page 4]
Internet-Draft                  IMAP Move                   October 2012

4.5.  IMAP Events in Sieve

   MOVE applies to IMAP events in Sieve [I-D.ietf-sieve-imap-sieve] in
   the same way as COPY does.  Therefore, MOVE can cause a Sieve script
   to be invoked with the imap.cause set to "COPY".  Because MOVE does
   not cause flags to be changed, a MOVE command will not result in a
   script invocation with the imap.cause set to "FLAG".

5.  Formal Syntax

   The following syntax specification uses the Augmented Backus-Naur
   Form (ABNF) notation as specified in [RFC5234].  [RFC3501] defines
   the non-terminals "capability", "command-select", "sequence-set" and

   Except as noted otherwise, all alphabetic characters are case-
   insensitive.  The use of upper or lower case characters to define
   token strings is for editorial clarity only.  Implementations MUST
   accept these strings in a case-insensitive fashion.

   capability     =/ "MOVE"

   command-select =/ move
   move = "MOVE" SP sequence-set SP mailbox
   uid = "UID" SP (copy / fetch / search / store / move)

6.  Security Considerations

   MOVE does not introduce any new capabilities to IMAP, and this limits
   the security impact.  However, the transactional semantics of MOVE
   may interact with specific implementations in ways that could have
   unexpected consequences.  For example, moving messages between
   folders under the quota root may require temporary suspension of
   quota checking.

   An additional area of concern is interaction with antispam,
   antivirus, and other security scanning and auditing mechanisms.
   Different folders may have different security policies which could
   interact with MOVE in complex ways.  Scanning with updated rules may
   also be required when messages are moved even with the underlying
   policy has not changed.

   MOVE does relieve a problem with the base specification, since client
   authors currently have to devise and implement complicated algorithms
   to handle partial failures of the STORE/COPY/EXPUNGE trio.
   Incomplete or improper implementation of these algorithms can lead to

Gulbrandsen & Freed      Expires April 23, 2013                 [Page 5]
Internet-Draft                  IMAP Move                   October 2012

   mail loss.

7.  IANA Considerations

   The IANA is requested to add MOVE to the "IMAP 4 Capabilities"

8.  Acknowledgments

   An extension like this has been proposed many times, by many people.
   This document is based on several of those, most recently that by
   Witold Krecicki.  Witold, Adrien W. de Croy, Bron Gondwana, Dan Karp,
   Barry Leiba, Alexey Melnikov, and others provided valuable comments.

9.  References

9.1.  Normative References

   [RFC2119]  Bradner, S., "Key words for use in RFCs to Indicate
              Requirement Levels", BCP 14, RFC 2119, March 1997.

              4rev1", RFC 3501, March 2003.

   [RFC4314]  Melnikov, A., "IMAP4 Access Control List (ACL) Extension",
              RFC 4314, December 2005.

   [RFC4315]  Crispin, M., "Internet Message Access Protocol (IMAP) -
              UIDPLUS extension", RFC 4315, December 2005.

   [RFC5234]  Crocker, D. and P. Overell, "Augmented BNF for Syntax
              Specifications: ABNF", STD 68, RFC 5234, January 2008.

9.2.  Informative References

              Leiba, B., "Support for Internet Message Access Protocol
              (IMAP) Events in Sieve", draft-ietf-sieve-imap-sieve-09
              (work in progress), September 2012.

   [RFC2087]  Myers, J., "IMAP4 QUOTA extension", RFC 2087,
              January 1997.

   [RFC5162]  Melnikov, A., Cridland, D., and C. Wilson, "IMAP4
              Extensions for Quick Mailbox Resynchronization", RFC 5162,

Gulbrandsen & Freed      Expires April 23, 2013                 [Page 6]
Internet-Draft                  IMAP Move                   October 2012

              March 2008.

Appendix A.  Change History

   RFC Editor: Please delete this section from the final RFC.

A.1.  Changes since -00

   1.  Fixed two bad nouns.  Mailboxes aren't messages.

   2.  Adrien's server can easily do UID MOVE but not so easily MSN-
       based moves.

A.2.  Changes since -01

   1.  Changed to Informative, on Barry's suggestion.  Or did I ask him?

   2.  Removed the 'reasons to avoid', it was doubleplusungood.

A.3.  Changes since draft-gulbrandsen-imap-move-02

   1.  Various wording changes from Barry's review.

   2.  Open issue: Delete the \deleted rule?

   3.  Back to PS, informative didn't fly in the IESG

   4.  Turned into a WG document in order to get write access to the
       IMAP4 capabilities registry

   5.  Mention VANISHED in 5162

   6.  Added bad boilerplate to please idnits.  This document contains
       no code.

A.4.  Changes since -00

   1.  Added MSN-based move.  The consensus seems mildly in favour.  I
       think.  We'll see once this is posted.

   2.  Advise sending COPYUID earlier, to help clients.  Requiring out
       of order processing is unnecessarily nasty.

   3.  Note that moving to the source inbox has to work.  I think it
       does have to work, but this is a draft, it says so on every page.

Gulbrandsen & Freed      Expires April 23, 2013                 [Page 7]
Internet-Draft                  IMAP Move                   October 2012

A.5.  Changes since -01

   1.   (Issue tracker #1) Changed command-select ABNF to conform with
        the conventions used in RFC 3501.

   2.   (Issue tracker #2) Banned overlapped pipelined MOVE and UID

   3.   (Issue tracker #3) Added section about interaction with IMAP

   4.   (Issue tracker #4) Revised security considerations.

   5.   (Issue tracker #5) Removed text that characterized MOVE as the
        same as COPY/STORE/EXPUNGE.

   6.   (Issue tracker #6) RFC 4314 is now a normative reference.

   7.   (Issue tracker #7) Major rewrite of the command description text
        as a result of AD review.

   8.   (Issue tracker #8) Revised abstract.

   9.   (Issue tracker #9) Added text saying partial failures are

   10.  (Issue tracker #10) Some additional tweaks to the security
        considerations section were made.

   11.  The abstract and introduction were out of whack as a result of
        other changes, so some revisions were made to bring them back
        into sync.

Authors' Addresses

   Arnt Gulbrandsen
   Schweppermannstr. 8
   D-81671 Muenchen

   Fax:   +49 89 4502 9758

Gulbrandsen & Freed      Expires April 23, 2013                 [Page 8]
Internet-Draft                  IMAP Move                   October 2012

   Ned Freed (editor)
   800 Royal Oaks
   Monrovia, CA  91016-6347


Gulbrandsen & Freed      Expires April 23, 2013                 [Page 9]