Smart Mailbox in Mail.app

I have a Smart Mailbox set up in mail called “unread mail”. It is supposed to find all unread emails, excluding those in the spam (spamsieve) folder. But for some reason the spam always shows up in my unread folder. Any suggestions as to how to fix this?

It should work to create a smart mailbox like the one shown here.

Unread Mail.png

doesn’t work
Here is a grab of my smart mailbox. There’s an extra junk mail folder that’s connected to a google imap account, but otherwise it’s the same. All messages in the spam folder still appear in the “unread mail” folder. Weird, huh?

smartmailbox.pdf (44.7 KB)

There are basically two cases where I’ve seen this happen:

  1. The messages are actually in another mailbox that you didn’t add to the smart mailbox conditions. (Some people have multiple mailboxes with the same names, so it can be a bit confusing.)
  2. Mail’s database is damaged, which prevents the smart mailbox “searches” from working properly. To rebuild it (on Lion) you can quit Mail, then rename the file:

/Users/<username>/Library/Mail/V2/MailData/Envelope Index

to “Envelope Index Old” and re-launch Mail so that it builds a new one. (You need to hold down the Option key when accessing the Finder’s Go menu in order to open the Library folder. Then open the Mail folder, then V2, then MailData to find the Envelop Index file.)

got it
There was a hidden gmail spam folder. Thanks for your help.