imaplib fetch message flags

Gabriel Genellina gagsl-py2 at
Mon Mar 2 05:16:54 CET 2009

En Mon, 02 Mar 2009 01:53:00 -0200, Rich Healey < at>  

> I'm using an example of an imap client I found with google as a
> framework for a more fullfeatured imap client.
> They use the line:
>  f = self.M.fetch(num, '(BODY[HEADER.FIELDS (SUBJECT FROM)])')
> To retrieve the Subject: and From: fields from the message. I'm curious
> about how to get the imap flags attached to the message, I can't find
> this anywhere. The documentation suggests that it's merely some flag as
> part of the `message_parts' argument to IMAP4{,_SSL}.fetch() method, but
> what I cannot find. I've tried
> but it doesn't have the desired result.

Try moving FLAGS out of the parenthesis (inside the outermost parenthesis):


RFC1730 <> defines IMAP4 and isn't  
hard to read.

Gabriel Genellina

More information about the Python-list mailing list