Re: [Extra] Implementation questions regarding IMAP REPLACE

Stuart Brandt <> Wed, 14 November 2018 03:14 UTC

Return-Path: <>
Received: from localhost (localhost []) by (Postfix) with ESMTP id 13662127148 for <>; Tue, 13 Nov 2018 19:14:50 -0800 (PST)
X-Virus-Scanned: amavisd-new at
X-Spam-Flag: NO
X-Spam-Score: -1.999
X-Spam-Status: No, score=-1.999 tagged_above=-999 required=5 tests=[BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, FREEMAIL_FROM=0.001, RCVD_IN_DNSWL_NONE=-0.0001, SPF_PASS=-0.001, URIBL_BLOCKED=0.001] autolearn=ham autolearn_force=no
Authentication-Results: (amavisd-new); dkim=pass (2048-bit key)
Received: from ([]) by localhost ( []) (amavisd-new, port 10024) with ESMTP id qxPbgQREYYL8 for <>; Tue, 13 Nov 2018 19:14:48 -0800 (PST)
Received: from ( []) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by (Postfix) with ESMTPS id F0BEA130ED7 for <>; Tue, 13 Nov 2018 19:14:43 -0800 (PST)
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;; s=a2048; t=1542165282; bh=UZN2l2bpexcXvo+omCqwdHpaRijYHU1rgr5UWHImxkY=; h=Subject:To:References:From:Date:In-Reply-To:From:Subject; b=azUINkKCtqJhcezNLWxUHWNky8D1MZlQ0aNl9MJp91akiU7zPlgP3WIejYwFrVDC1mZi17kIOnQJ+kdsmtXizSo4vvSjcK+kZVJasF3tPEWaLBFYqk6NErxC3ndSoKUZ3pIZb8qn87mSWgtWvCd+mfJ8ia4/mrkuxHEJHtKk5APToyreu1Smsr1s66hw1Yg9u8OnByNGYnyG4sV43esnMabg9mg5uT5G8OaezO7E3o174z9cO2/ZX7Sttz0Ua6oz7QY+oJFczA4e3rlCUu2EHHO74M9XXn6rJ625oc8yHgJ0RKU1pighjHZBVTnAkE3QmYWM+f16Cf9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aDZg zrkDlCeqWm_USQg--
Received: from by with HTTP; Wed, 14 Nov 2018 03:14:42 +0000
Received: from (EHLO []) ([]) by (Oath Hermes SMTP Server) with ESMTPA ID fe4192eb452ec1a6c83a1a1b6fdc1776 for <>; Wed, 14 Nov 2018 03:14:39 +0000 (UTC)
References: <>
From: Stuart Brandt <>
Message-ID: <>
Date: Tue, 13 Nov 2018 22:14:12 -0500
User-Agent: Mozilla/5.0 (Windows NT 6.1; WOW64; rv:38.0) Gecko/20100101 Thunderbird/38.5.0
MIME-Version: 1.0
In-Reply-To: <>
Content-Type: text/plain; charset=windows-1252; format=flowed
Content-Transfer-Encoding: 7bit
Archived-At: <>
Subject: Re: [Extra] Implementation questions regarding IMAP REPLACE
X-Mailman-Version: 2.1.29
Precedence: list
List-Id: Email mailstore and eXtensions To Revise or Amend <>
List-Unsubscribe: <>, <>
List-Archive: <>
List-Post: <>
List-Help: <>
List-Subscribe: <>, <>
X-List-Received-Date: Wed, 14 Nov 2018 03:14:50 -0000

Stephan -

Thanks for the input...comments inline:

On 11/13/2018 6:10 PM, Stephan Bosch wrote:
> Hi,
> I've been evaluating a bit what effort an implementation of IMAP REPLACE
> would require at our end. I got two remarks/questions now:
> 1) The MOVE capability has some overlap with this one and that document
> states the following:
>     The server may send EXPUNGE (or VANISHED) responses before the tagged
>     response, so the client cannot safely send more commands with message
>     sequence number arguments while the server is processing MOVE or UID
>     MOVE.
>     Both MOVE and UID MOVE can be pipelined with other commands, but care
>     has to be taken.  Both commands modify sequence numbers and also
>     allow unrelated EXPUNGE responses.  The renumbering of other messages
>     in the source mailbox following any EXPUNGE response can be
>     surprising and makes it unsafe to pipeline any command that relies on
>     message sequence numbers after a MOVE or UID MOVE.  Similarly, MOVE
>     cannot be pipelined with a command that might cause message
>     renumbering.  See[RFC3501], Section 5.5 <>, for more information about
>     ambiguities as well as handling requirements for both clients and
>     servers.
> I'd say similar considerations apply to REPLACE, don't they?

Likely, yes.

> 2) What happens when the replaced message does not exist at all (no such
> seqnum/UID). Will the whole command fail or will it assume that the
> replaced message is already expunged and continue as a normal APPEND?

The intention is that it would fail and fail quickly -- prior to upload 
of the replacing data. Continuing with the Append can be problematic in 
a multi-client/session scenario and can lead to re-introduction of a 
Draft that was already sent or creation of a draft that appears newer 
than the one that replaced the referenced message. Additionally, it's 
important that a client actually *know* when it's not in sync with the 
present mail store, something that's downright dangerous when dealing 
with sequence numbers.

> Regards,
> Stephan.
> _______________________________________________
> Extra mailing list