Search code examples
imapgmail-imap

Access gmail star color from IMAP


Gmail has more stars than just the yellow colored star but they are not enabled by default. http://support.google.com/mail/bin/answer.py?hl=en&answer=5904

Is it possible to search for all messages in Gmail with a certain star color from an IMAP client?

I have tried the following with no success:

tag SEARCH X-GM-RAW "has:red-star"

tag SEARCH X-GM-RAW "has:red-star in:inbox"

tag SEARCH X-GM-RAW "has:red-star in:anywhere"

Solution

  • Yeah, that should totally work. From the Gmail IMAP Extensions page:

    Extension of the SEARCH command: X-GM-RAW

    To provide access to the full Gmail search syntax, Gmail provides the X-GM-RAW search attribute. Arguments passed along with the X-GM-RAW attribute when executing the SEARCH or UID SEARCH commands will be interpreted in the same manner as in the Gmail web interface.

    For stars, the advanced search syntax for Gmail notes that you can use these query parameters:

    has:yellow-star
    has:red-star
    has:orange-star
    has:green-star
    has:blue-star
    has:purple-star
    has:red-bang
    has:orange-guillemet
    has:yellow-bang
    has:green-check
    has:blue-info
    has:purple-question
    

    Does your search work without has:red-star?