[Imap-protocol] reporting/detecting expunged messages

Bill Shannon bill.shannon at sun.com
Mon Sep 11 16:36:30 PDT 2006


A JavaMail user encountered the following situations when another
client expunged a message being accessed by JavaMail.

First, fetching the content of the message failed:

A5 FETCH 1 (BODYSTRUCTURE)
* 1 FETCH (BODYSTRUCTURE ("TEXT" "PLAIN" ("charset" "UTF-8") NIL NIL "7BIT" 23 1
NIL NIL NIL) FLAGS (\Deleted))
A5 OK FETCH completed.
A6 FETCH 1 (BODY.PEEK[TEXT]<0.23>)
A6 NO Some messages in the mailbox had previously been expunged and could not be
returned.

With no opportunity to report an untagged EXPUNGED response, the command
simply failed with a NO response.

Second, fetching the BODYSTRUCTURE of an expunged message simply
failed to return the requested information although the command succeeded:

A5 FETCH 1 (BODYSTRUCTURE)
* 1 FETCH (FLAGS (\Deleted))
A5 OK FETCH completed.

Is this allowed behavior for an IMAP server?

Assuming it is, what is the recommended way for a client to detect this
situation so that it can distinguish a "message has been expunged" failure
from any other random failure? Should the client follow such failures
with a NOOP to allow the server to report that the message has been
expunged?

It might be nice if there were a response code to indicate that the message
has been expunged, e.g.,

A6 FETCH 1 (BODY.PEEK[TEXT]<0.23>)
A6 NO [EXPUNGED 1] Some messages in the mailbox had previously been expunged and
could not be returned.

A5 FETCH 1 (BODYSTRUCTURE)
* 1 FETCH (FLAGS (\Deleted))
A5 OK [EXPUNGED 1] FETCH completed.



More information about the Imap-protocol mailing list