Gmail – Mark Spam Messages as Read


I had mentioned in an earlier post that I was mildly frustrated by the “new spam messages” counter in Gmail, mostly because I mistook it for the “new inbox messages” counter in my peripheral vision. Before my hard drive crash, I used a Firefox plug-in called Greasemonkey to hide the counter. This solution turned out to be inelegant when I realized that at work, at school, and on any computer other than my own I would still be visually assaulted by that silly counter. I decided then and there that there must be a better way.

Fortunately for me, there was. I had previously tried to go about using the remarkably versatile Gmail filters to mark all spam messages as read, but lacked an adequate description of what messages to mark. A closer look into Gmail search semantics revealed that I could use the keywords “in:spam” to refer to the all messages in my spam folder. Knowing this, I set up the following filters:

  • Has the words: in:spam
  • Doesn’t have: my name, my school, my work, etc.
  • Do this: Mark as read

This filter simple and efficiently hides all new spam messages, while still alerting me when potential non-spam messages have been blocked. If you’re as fussy as I am when it comes to Gmail, I hope that this little trick comes in handy.

→ 37 CommentsTags:

37 Responses to “Gmail – Mark Spam Messages as Read”

  1. Vivek Jishtu Says:
    November 17th, 2007 at 2:39 pm

    I have been looking for something like this for a while.

  2. Anonymous Says:
    November 17th, 2007 at 2:52 pm

    Works great, but be aware that the “Mark as read” option is only available with the newer Gmail interface, which at the moment is still locking up my Firefox on Windows.

  3. TonNet Says:
    November 17th, 2007 at 2:53 pm

    Thanks for the heads up, man!

  4. Vtr - Pão com ovo e coca-cola Says:
    November 17th, 2007 at 3:34 pm

    I delete it. In my trip to putting my address everywhere, I end up with various spam (viagra? porn?). I just set it to delete all that crap.

    Nice tip, by the way.

  5. Junior Bodine Says:
    November 17th, 2007 at 4:05 pm

    The CustomizeGoogle FireFox extension also can hide the spam counter. It works most of the time, but fails occasionally.

    I now use your “in:spam” filter as a backup measure, just in case.

    Thanks for the great tip.

  6. Bruce Says:
    November 17th, 2007 at 4:09 pm

    Awesome! I just created my filter and it works beautifully!

    What a fantastic idea – thanks for sharing that with all of us.

  7. Doug Holton Says:
    November 17th, 2007 at 4:26 pm

    Yeah the spam count is so annoying that I always use Thunderbird now instead of the website.
    I requested a way to just delete spam rather than constantly remind me of it years ago, but google never fixed this:

    So thanks for the tip. Now that gmail supports IMAP though, I never need to use the website.

  8. Matthew Gallant Says:
    November 17th, 2007 at 4:37 pm

    Thank you! I’m glad you found it useful.

    @Doug Holton:
    I’ve set up my Gmail with Thunderbird at home as well, with the MinimizeToTrayand MinimizeToTrayEnhancer
    add-ons to let it run in the background. However, I usually just use this to give me an offline copy of my e-mail, as well as notify me when new mail arrives. For day to day use I find the Gmail interface is much nicer to work with than Thunderbird, but that’s just personal preference. Thanks for the comment!

  9. Ian Says:
    November 17th, 2007 at 6:35 pm

    should it work if I ‘skip inbox’ and archive it? will it still mark it as read if archived? (see what anonymous said above). I am using opera with gmail IMAP and there are currently issues due to a clash in their similar fucntionality, this causes duplicated mail among other things, but most annoying was the spam getting into opera’s ‘unread’ accesspoint. I have had no new spam messages to test whether or not it works yet! great manipulation of gmail though, thanks for sharing.

  10. Matthew Gallant Says:
    November 17th, 2007 at 6:50 pm

    I did a bit of reading around the Opera + Gmail problem, what a frustrating bug. I’d be curious to know what happened if you used the same filter, but chose “Delete it” instead of marking them as read.

    As for choosing “Skip inbox”, I’m really not sure how that would work. My best guess would be either:
    a) Spam messages never reach the inbox, so the filter has no effect.
    b) The spam messages would be archived with all other mail, which would be bad!
    If you do test it, please let me know the results.

  11. DyNama Says:
    November 18th, 2007 at 4:13 am

    i was going to try this with my domain mail hosted at gmail (google apps) but “mark as read” is not an option! it is there in my old @gmail.com mailboxes however but i don’t use them anymore.

  12. Martijn Coppoolse Says:
    November 18th, 2007 at 11:04 am


    A short test with my old GMail-account shows that “Skip the Inbox (archive message)” makes the spam messages available in the “All Mail” folder… Not what you’d want!

    I’ll wait until “Mark message as read” is rolled out to GAFYD-accounts.

  13. Matthew Gallant Says:
    November 18th, 2007 at 3:36 pm

    @Martijn Coppoolse:
    Thanks for letting me know.

  14. Anonymous Says:
    November 18th, 2007 at 5:44 pm

    You also need to have the Language set to English (US) to get “Mark as read”

  15. Marsh Says:
    November 19th, 2007 at 7:28 pm

    Nice tip!

    Here’s a way to add this filter using Gmail’s new for permalinks support. Just change “my name” to your name and tell the fliter to “Mark as read”. ;)

  16. Matthew Gallant Says:
    November 19th, 2007 at 8:28 pm

    Gmail certainly has some strange idiosyncrasies…

    Thanks for the tip!

  17. Andrew Says:
    November 19th, 2007 at 10:31 pm

    thanks man! i’ve been looking for a way to note folder location in a filter!

    i use apple mail with gmail imap, and ever time i get a new e-mail the mail counter will list it both in the inbox and the “all mail” (archive) folder–and it will continue to be listed in all mail, even after i’ve marked the inbox version as “read.”

    i tried to setup a filter through apple mail but couldn’t find a way to specify folder location; now, however, after reading your tip i am golden!

    glad to see other people out there are as OCD as i am about their…everything.

  18. phalkon30 Says:
    February 7th, 2008 at 3:31 am

    I’ve emailed google numerous times about this, it really bugs me. I was so excited when I saw this (especially because of how it’s done, very nice).

    BUT, I don’t have the option to “mark as read”. I have set me language to english US as instructed above, no help. I have a normal @gmail.com address from when gmail was fairly new. I’m pretty sure I have the latest gmail (I believe I saw it upgrade a while back). Can a force an update?

  19. Matthew Says:
    February 7th, 2008 at 5:19 am

    I did some googling about your problem phalkon, no luck so far.

    One option might be to set your language to “english US” and leave for a day or two. Perhaps when the gmail servers update, they’ll see your language and upgrade your account? I’m just guessing here, but it might be worth a shot.

    You could also try asking Google groups specifically about the missing “mark as read” problem.

  20. phalkon30 Says:
    February 7th, 2008 at 11:07 pm

    Thanks for looking around. I have always had my language set to English US AFAIK.

    I happened to log in at work today (different computer), and I found out that I could do the “mark as read” option. When I got home, I looked at my filters, and it’s blank for the “do” function of that filter. So I think I’ll have to play with clearing my cookies/cache. I leave gmail up in a tab in maxthon that has been open for over a year (maxthon saves your session).

  21. Matthew Says:
    February 7th, 2008 at 11:14 pm

    Looks like you’ve found the problem!

  22. Jason Says:
    February 9th, 2008 at 9:28 am

    You, sir, are a genius!

  23. Ahava Says:
    February 10th, 2008 at 4:23 pm

    This is beautiful! I’ve enjoyed the monkeyscript for a long time, but this is indeed a more elegant solution. Thankyou!

  24. phalkon30 Says:
    February 17th, 2008 at 12:57 am

    Aha! I figured out why some people have the old version, and some have the new.

    If you use IE6, you have to use the old version.
    If you use IE7 or firefox, you get the new version.

    I refuse to use IE7, and I like using maxthon (which is based off of IE), so I guess I’m stuck using the old gmail.

    The nice thing is, if you set it up in the new gmail, it still works if you’re on a computer that uses the old interface. So if you don’t like IE7, find somebody that has it, set the filter, and you’re good.

  25. Mike Says:
    February 19th, 2008 at 7:20 pm

    When I attempt to put my name in the “doesn’t have” field, the filter no longer catches any messages. My name does not appear anywhere in the body of the message, but my address is mike.lastname@gmail.com so I assume that is what it is picking up. Any suggestions?

  26. Matthew Gallant Says:
    February 19th, 2008 at 10:34 pm

    Unfortunately there doesn’t appear to be a filter that specific in Gmail, Mike. We can only hope that Google adds advanced filtering in the future, which seems likely given how well Gmail has grown.

  27. Jason Says:
    March 20th, 2008 at 10:44 pm

    Great. Love this.

  28. RacerX Says:
    March 21st, 2008 at 2:12 pm

    Great tip! Even if I don’t much care about the unread count on SPAM, it saves me from scanning through it so diligently looking for improperly marked spam.


  29. Glenn Says:
    April 4th, 2008 at 12:55 pm

    Thank you so much! I’ve been trying to reclaim my inbox lately and this was the perfect solution for my only remaining problem.

  30. John Gallias Says:
    April 22nd, 2008 at 2:14 pm

    Exactly what I needed! Thank you.

  31. Rob A Says:
    April 27th, 2008 at 1:24 am

    You sir are a legend!

    This function seems to not be working in the ‘Better Gmail 2’ addon and has been annoying the crap out of me for weeks.

    Keep up the great work!

  32. Andrew Says:
    April 29th, 2008 at 3:58 pm

    THANK YOU!!! For the longest time I avoided spam… Once those horrible people nabbed my email address, I get this wrenching feeling of failure every time I see the counter go up. Thanks for alleviate the problem.

  33. ?? Says:
    September 21st, 2008 at 11:14 pm

    Warning: Filter searches containing label:, in:, or is: criteria are not recommended, as these criteria will never match incoming mail.

    Do you still wish to continue to the next step?

  34. Matthew Gallant Says:
    September 22nd, 2008 at 2:44 am

    You can just ignore that warning, Gmail is lying ;)

  35. mits Says:
    September 22nd, 2008 at 8:57 pm

    great tip, thanks!

  36. PJ Says:
    October 20th, 2008 at 2:51 am

    wonderful !!
    i just switched from pop to imap with gmail and apple mail and i was frustrated by the mess it caused to my very organised mailboxes in mail…
    but now, everything is perfect !!
    i can use my gmail account with Mail and my iPhone, and everything is perfectly synchronised !!

  37. Flo Says:
    February 24th, 2009 at 11:59 am

    Thaks a lot. Exactly what i was looking for!

© 2007-2020 Matthew Gallant. Powered by Wordpress. Privacy Policy.