I really like GMail's spam filters. However, they occasionally catch not-spam so I like to quickly scan the contents of spam folder every so often, marking "not spam" to the few messages that aren't and deleting the rest so I know what I've checked.

In order to make looking through the spam filter easier, is it possible to create a gmail filter that would act like this and auto-delete incoming mail?

If GMail thinks this is spam AND contains 'Vigara' or 'Cilais'  THEN delete forever.

Just a quick note, I intentionally misspelled the drug names, that is common for the 400+ messages per day that I'm seeing.

3 Answers 3


I forward all my mail from one of my Gmail accounts to another Gmail account, including what Gmail would normally filter to the Spam folder. I use the is:spam query with the Never send it to Spam rule in the inbound filter to allow spam to be forwarded. Do note the use of is rather than in.

Therefore, I imagine you could do the same with the following filter:

Contains is:spam (vigara OR cilais), Action Delete it.

If you wanted to apply the rule universally, you could instead use:

Contains (is:spam OR -is:spam) (vigara OR cilais), Action Delete it.

Note that Delete it automatically implies Never send it to Spam so you don't need to check the latter check box. In fact, if you check it, Gmail will uncheck it automatically. I am uncertain as to whether this will impact Gmail's internal spam detection heuristics, but I find that improbable.

Caveat: you cannot delete permanently from a filter rule (I imagine Google believes the risk too great and not worth the potential increase in support costs), so those messages would end up in your Trash and get purged after 30 days. This may still be a better situation to find yourself in, depending on your preferences and the volume of spam you get (which could now make it harder for you to recover messages deleted by mistakes).

If cluttering your Trash is not desirable, you could filter those messages to a temporary label instead, then use an Apps Script to periodically delete "old" filtered spam from that label. That would ensure that the top of your Trash is clutter-free. If the volume of spam you receive is limited however, deleting might work just fine.

  • I'm not sure I understand, are you say I can do this all in one account? If so, than that runs into the same problem that @Fogest has, which is that "in" and "is" words won't work on incoming mail.
    – kbyrd
    Sep 14, 2012 at 19:18
  • 1
    It works for me on incoming mail. I opened with that statement about forwarding to illustrate how I currently use the is operating to process incoming spam (marking it as not spam).
    – user13779
    Sep 14, 2012 at 20:44
  • 2
    I just tried this and it appears to work! I'll go a few more hours or so and if it all behaves the way I want, I'll mark this as the correct answer. As a side note, the reason I'm getting so many of these is that this account is the default for all unkown addresses for my domain (*@mydomain.com), I do that so I can receive and filter <username>-<foldername>@mydomain.com. I've been using the '-' extension for years and it's too painful to switch to '+' in all the various places.
    – kbyrd
    Sep 16, 2012 at 18:23
  • 2
    Good deal. I know it's confusing because Gmail warns you that is will never match on incoming mail, but it's a lie :) At worst I imagine that could mean the rule may stop working in the future.
    – user13779
    Sep 16, 2012 at 22:10

Yes you can do something like this. In GMail's search bar enter something like the following:

in:spam subject:viagra OR Cilais

You could also do something like:

in:spam viagra OR Cilais

This one checks the whole email and subject whereas the first one only checks the subject.

Once you have done the search you can hit the more button and select the option to create a filter with this search.

spam search sample

  • This won't affect incoming mail. Gmail won't let you use labels (in:spam) to affect incoming mail. I have updated my question to make it clear I'd like to affect incoming mail so it never hits the spam folder.
    – kbyrd
    Sep 12, 2012 at 20:01
  • @kbyrd Same idea, just use in:inbox rather than in:spam. Sep 12, 2012 at 20:05
  • But, that's not what my question asked for. I'm looking for: GMail think this is spam AND (vigara OR cilais)
    – kbyrd
    Sep 12, 2012 at 20:08
  • @kbyrd If GMail thinks something is spam it moves it to the spam folder. Of course you could use some other filters and move all the emails from spam to the another folder such as the inbox, and then sort that folder, and move the stuff you don't want in it to another folder. It's hard to change how GMail works. Sep 12, 2012 at 20:15
  • 1
    Correct me if I'm wrong, but it looks like the original poster wants something like an Outlook rule, where you can specify that if an email meets a specific criteria (in this case flagged as spam and containing specific words) that it gets permanently deleted, not just moved to spam. I was just wondering this myself today, so I'm interested to know if anyone knows how to do it.
    – techturtle
    Sep 12, 2012 at 20:54

You can turn use "multiple inboxes" to get all these special spam emails in a separate box

  1. Go to settings/Labs and select "Multiple inboxes"
  2. Save Changes
  3. You should now see a "Multiple inboxes" tab in settings.
  4. GMail will let you specify a search query. In the first box enter "in:spam viagra or Cilais" without the quotes.
  5. Set the maximum page size to a larger number. It didn't complain about using 50, but I don't know if there is a maximum value.
  6. Set "Extra panels positioning" to Below the inbox. This will put the "All Mail" label below the main inbox.
  7. Save changes

There may be a couple of second lag the first time you go back to the main page, because it has to execute the new query.

You can select all the conversations in this "inbox" and delete them.

It does the job with a couple of issues:

  • Each inbox has its own < and > button to move through the list
  • Each inbox has its own "view all" button which jumps you to the label
  • The gear button is only on the tool bar above the main inbox section.
  • 1
    This is closes to what I want. It gives me a quick way to constantly clean up the obvious stuff. I should point out that you need to be in "Classic Inbox" view to see the multiple inboxes. This doesn't work with "Priority" inbox types.
    – kbyrd
    Sep 13, 2012 at 15:25

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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