How-To Geek

Get Rid of the Unread Spam Message Count in Gmail and Your IMAP Client

If you are a Gmail user, you’ve probably noticed the annoying unread message count for the Spam folder. It’s even worse when you use an IMAP client to access your email, and then try and use a search folder for unread mail… which gives you nothing but spam.

What we’ll do is use Gmail’s filter capabilities to create a filter that automatically marks spam messages as read, preventing the unread count from appearing anywhere.


This method should work for both Gmail as well as any IMAP client that you use. (Note: This only works if you are using the new gmail interface.)

Mark All Spam as Read Automatically

Open up Gmail and then click the link to create a new filter. In the “Has the words” box, enter “in:spam” (without the quotes) as you can see in the image below. You can use the Test Search button to make sure it shows just spam emails.


Now click the Next Step button, and ignore the error message you get. Select the checkbox for “Mark as read”, and then click the Create Filter button. Note that you could auto-delete all spam using this same filter, although I’m not recommending that.


At this point, all incoming spam will be automatically marked as read. (You’d want to clear out the current spam, of course)


The best part is that you no longer have to deal with the unread count in your IMAP client either:


I don’t understand why some of this spam isn’t just automatically deleted.

Lowell Heddings, better known online as the How-To Geek, spends all his free time bringing you fresh geekery on a daily basis. You can follow him on if you'd like.

  • Published 05/28/08

Comments (20)

  1. Mike

    I love gmail, but have always found they made an error in showing unread spam so clearly. So to me this would be a great tip if it would work. Unfortunately it doesn’t if you use to less cluttered ‘old’ interface :(

  2. The Geek

    Ah, that’s a good point… I think this only works in the new gmail interface. Will add that to the article.

  3. Martis

    Nice tip, thanks, already made it ;)

  4. Chris

    Noticed Thunderbird doesnt count email in my Gmail Spam folder

  5. Rohit

    But i use thunderbird + IMAP

    I don’t see SPAM folder !

  6. Norcross

    Outlook 2007 doesn’t include it in the overall email count (I rarely, if ever, use gmail online), however, I’ve been looking for a way to have them always marked as “read” so I don’t have to do it manually.

    I wonder if there is a way to speed up the default 30-day spam deleting?

  7. Mike

    Wouldn’t this also send read receipt to the spammer also letting them know that your account exists and is active.

  8. The Geek


    That’s a good question. I don’t really worry about that type of thing, since they already have your address and are currently spamming you… plus Gmail does an excellent job of blocking spammers.

  9. jd2066

    I don’t think so.
    From what I’ve seen an email client on acts on a read receipt when you open the message. Not when marking it read.

  10. Bobzero

    Thanks Geek, as soon as i applied the filter guess what happened?

    …Hooray spam is gone!, another Gem from the Geek..

  11. Spencer

    Hi, I have a question. Instead of simply marking it as “read”, couldn’t you just check “Delete It”, and then never see the Spam in your spam folder?

  12. JC

    I never fail to be amazed at how consistently USEFUL your posts are. Some jerk signed me up for multiple gay porn spam mailing lists a few days after I got my gmail account. Your method is a godsend. Thanks again.

  13. Damian

    Awesome thanks!

  14. The Geek

    Yes, you can choose delete… I don’t do it because sometimes legit email gets stuck in the spam filter.

    As a person with a publicly available email address, I can feel your pain. I’ve had people fraudulently sign me up for all sorts of unsavory stuff.

    That’s a good question… I’m currently exploring how the outlook rules work with gmail imap.

  15. virii

    I use this same method, but simply choose to delete it rather than “mark as read”. I rarely (if ever) receive legitimate email in my Spam folder. Now…if there was a way to automatically delete it from the trash, that would be useful…

  16. Terra

    Hi Geek, Thanks for the advice, but as of today I do not see the option to mark it as read on my gmail account :(

  17. Dylan

    Thanks for this! I was pulling my hair out trying to keep spam from showing up in my unread messages Outlook search folder. Setting the rule to delete spam messages fixed that. There’s so much spam that should be auto deleted that I’d never see a legit message anyways, so I never open the folder. Might as well just delete everything…

  18. zampano

    Thank you !! This has been bugging me. The windows livemail new mail thing in the taskbar has me checking spam.

  19. tim

    thanks, this was just what i was looking for :)

  20. Prab

    Very nice; Thank you for educating us!

More Articles You Might Like

Enter Your Email Here to Get Access for Free:

Go check your email!