This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

Author char.nikolaou
Recipients char.nikolaou
Date 2011-11-23.12:52:13
SpamBayes Score 4.445994e-07
Marked as misclassified No
Message-id <1322052734.51.0.798598856124.issue13446@psf.upfronthosting.co.za>
In-reply-to
Content
Hi, actually I must have found the real culprit. And this is that imaplib does not include a function for the "EXAMINE" command. What it does is that when a user selects a mailbox as readonly, it executes an EXAMINE command instead of a SELEECT command, which is wrong according to RFC2060 (http://james.apache.org/server/rfclist/imap4/rfc2060.txt) that explicitly states the following:

"Read-only access through SELECT differs from the EXAMINE command in that certain read-only mailboxes MAY permit the change of permanent state on a per-user (as opposed to global) basis.  Netnews messages marked in  a server-based .newsrc file are an example of such per-user permanent state that can be modified with read-only mailboxes."

As a consequence of the above text, if a mailbox has been selected with the EXAMINE command, fetching a mail does not make the mail as read, which would be done if the mailbox had been selected with the SELECT command even in the case the mailbox had read-only permissions.

A quick patch for imaplib is to have it not raising any exceptions when checking the READ-ONLY state. In this way, one can open a read-only mailbox using the SELECT command as follows:

imap.select(mailbox)

Preventing imaplib from raising exceptions when using the above command with read-only mailboxes, it allows someone to fetch a message and then marked it as seen. After all, the exceptions are of no use, because the IMAP server is responsible for making security checks and not the client.

To have imaplib be compliant with RFC2060, I propose including an examine function which would be like select. Pure and simply.

I attach a patch for imaplib 2.58 (Python 2.6.2) which "solves" this misbehavior by not raising exceptions for READ-ONLY mailboxes when having opened them without "readonly=True". 

What are your opinions on this?
History
Date User Action Args
2011-11-23 12:52:14char.nikolaousetrecipients: + char.nikolaou
2011-11-23 12:52:14char.nikolaousetmessageid: <1322052734.51.0.798598856124.issue13446@psf.upfronthosting.co.za>
2011-11-23 12:52:13char.nikolaoulinkissue13446 messages
2011-11-23 12:52:13char.nikolaoucreate