Web Applications Stack Exchange is a question and answer site for power users of web applications. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I need to implement a Gmail filter that automatically moves a mail to another folder (not the inbox) if the Priority Inbox decided that it's not important. I saw there is an API for developing gadgets (interface elements), and IMAP. Could IMAP be used for this? If not, is there a chance to implement this functionality?

Edit: Let me clarify a bit. The client has Priority Inbox enabled and when using the web interface there is no problem. But when he accesses the mail from his iPhone using the built-in app all messages are treated the same, as if there was no Priority Inbox. He wants something that automatically moves all mails that are not in the Priority Inbox to another folder, so that in the inbox remains only important mail (think of it as an emulation of PI for apps that don't support it).

share|improve this question

migrated from stackoverflow.com Feb 5 '11 at 17:05

This question came from our site for professional and enthusiast programmers.

@bw_üezi, 'important'/'not important' refers to a specific feature in gmail. It's perfectly clear if you've used gmail... – bdonlan Feb 5 '11 at 10:06
Regarding using IMAP, there are ways to update filter rules via IMAP, but they're very new extensions/protocols and I believe that GMail doesn't support them yet. So no dice on the IMAP side. – dkarp Feb 5 '11 at 12:14
For what it's worth, the Android Gmail app lets you view the Priority Inbox or the regular Inbox. – Al E. Feb 5 '11 at 18:34

There is a "not marked as important" condition: in:inbox -is:important

With minus you get the opposite results.
Create a custom filter with in:inbox -is:important in the filed Has the words and skip the inbox and create a new label "not important".

share|improve this answer
This filter won't work. According to Google: "Filter searches containing "label:", "in:", "is:", or stars criteria (i.e. "has:yellow-star") are not recommended as they will never match incoming mail." – Alexander Shcheblikin Oct 3 '13 at 23:03

whilst viewing a message click 'more action -> filter messages like these'

from this area you can create custom filters.


It can be done with a little trick - apply skip the inbox and also create a new label called Not important. This has the effect you described.

share|improve this answer
This doesn't work for what I want. I would need a field named "Not important", like "Has attachment" currently is. – lgratian Feb 5 '11 at 8:42
Gmail's filters do not have 'not marked as important' as a condition. – bdonlan Feb 5 '11 at 8:52
It can be done with a little trick - apply skip the inbox and also create a new label called Not important. This has the effect you described. – shane Feb 5 '11 at 9:01
@shane - this seems to work, thanks. – lgratian Feb 5 '11 at 9:30
:) You're welcome! – shane Feb 5 '11 at 9:32

The trick I use is to create a dummy filter (just use a random string in the "Does not contain" field of the filter) to move everything into the "Not important" label AND tick the "Override filters" option in the Inbox configuration which will force all important messages to appear in the default Inbox.

This seems to work fine via IMAP.

(Of course, "skip the inbox" needs to be enabled for this filter.)

share|improve this answer

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.