How can I get MESSAAGE's Flag using Imaplib

Donn Cave donn at oz.net
Thu Aug 24 12:02:24 EDT 2000


Quoth "¼­ÁØ¿ø" <linuxqna at chollian.net>:
| Hi, I'm not English very well. Understand me ^^.
| I'm programming Web mail program using Python with Imaplib..
|
| How can I get Message's Flag (Unread, Seen, Reply...)
| Please teach me..

Assuming srv is an instance of IMAP4, and you want both flags
and headers for messages 1 through 5 in the currently selected
folder -

      status, result = srv.fetch('1:5', '(FLAGS RFC822.HEADER)')

Now you have in "result" a sequence of strings, with all the
information you requested.  It's not broken up in the most
convenient way for you -- you will need to use some string
functions to extract the flags and everything.

	Donn Cave, donn at oz.net



More information about the Python-list mailing list