imaplib fetch message flags

Gabriel Genellina gagsl-py2 at yahoo.com.ar
Sun Mar 1 23:16:54 EST 2009


En Mon, 02 Mar 2009 01:53:00 -0200, Rich Healey <healey.rich at gmail.com>  
escribió:

> 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
> (BODY[HEADER.FIELDS (SUBJECT FROM FLAGS)])
> but it doesn't have the desired result.

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

(FLAGS BODY[HEADER.FIELDS (SUBJECT FROM)])

RFC1730 <http://www.faqs.org/rfcs/rfc1730.html> defines IMAP4 and isn't  
hard to read.

-- 
Gabriel Genellina




More information about the Python-list mailing list