How is spam handled for IMAP?
Gmail's spam filters also work in your IMAP client by automatically diverting messages that are suspected of being unwanted messages into '[Gmail]/Spam' and keeping them out of your inbox.
If you find a message that should be marked as spam, just move it to '[Gmail]/Spam.' This is just like clicking 'Report Spam' in the Gmail web interface and helps us to improve our spam filters.
If you find a message incorrectly classified as spam, you can move the message out of '[Gmail]/Spam' to the Inbox folder in your client.
Note that your client may have its own junk mail filtering technology, which is separate from Gmail's spam filtering. We recommend using only Gmail's spam filtering and turning off any additional anti-spam or junk mail filters within your client. If you still decide to enable client side spam filtering, your client will download an extra copy of every message.