setting email FLAGs in IMAP4 box

Tony Meyer t-meyer at ihug.co.nz
Tue Feb 10 16:54:03 EST 2004


>      imap = imaplib.IMAP4("hostname")
>      imap.login("name","passwd")
>      imap.select("INBOX",1)
>      imap.store(1, 'FLAGS', '(\Deleted)')

You're selecting the INBOX folder as read-only, which means that you can't
write any changes, including flags, to it.  Doing this:

>>> import imaplib
>>> imap = imaplib.IMAP4("hostname")
>>> imap.login("name","passwd")
>>> imap.select("INBOX") # read-only defaults to False
>>> imap.store(1, 'FLAGS', '(\Deleted)')

Works fine for me, and should for you.

=Tony Meyer





More information about the Python-list mailing list