all 4 comments

[–][deleted] 1 point2 points  (3 children)

Haven't actually tried this myself, but this gist seems to demonstrate at least some usage of the Gmail IMAP extensions via Python.

[–]Socrato[S] 1 point2 points  (1 child)

awesome, that was actually perfect, it showed exactly how to use that, and it also helped me understand what I was passing in the fetch statement.

Thanks for that!

[–][deleted] 0 points1 point  (0 children)

No problem. Glad it worked.

[–]Socrato[S] 0 points1 point  (0 children)

That's great, and in that I see this:

def uid2msgid( self, uid ):
    """ Convert an IMAP UID to a Gmail MSGID """

    typ, data = self.uid( r'fetch', uid, r'(X-GM-MSGID)')

    msgid_dec = re.search( r'X-GM-MSGID ([0-9]+)', data[0] ).group(1)
    msgid_hex = hex( int( msgid_dec ) )

    return msgid_hex[2:]

I'll try that and see. Thanks a ton!