Sunday, November 09, 2008

Crap. Gmail IMAP doesn't support searching by header Message-ID

I just spent the last hour trying to figure out why my IMAP query is failing. I'm testing an IMAP integration with gmail. Here is my query:

>>> type, data = mail.search(None, '(HEADER Message-ID "<799d9ef60811090712j14c90d46hf9939af135dc5a19@mail.gmail.com>")')
>>> data
['']

I should have mentioned that I'm using python IMAPLIB.

Even though the message-id is valid (there is a message with this ID), nothing is returned. Why? It's just not supported. From google:

http://mail.google.com/support/bin/answer.py?answer=78761&topic=12762&disablechatbrowsercheck=1

Does Gmail support all IMAP features?

Gmail IMAP is a fairly complete implementation of IMAP, but the following features are currently unsupported:

  • \Answered and \Recent flags on messages.
  • Substring search. All searches are assumed to be words.
  • Searching arbitrary headers. Only some headers are available for searches: From/CC/BCC/To/Subject.
  • There is no SIEVE interface to Gmail filters.
  • Only plain-text LOGIN over SSL tunneled connections are supported.
Yep, that's pretty much the feature I needed. Poop!

No comments: