IMAP and - How to count spam/junk

I have a domain hosted at and lately seem to be missing mails that are not spam but that end up in the spam-folder anyway.

I’m now trying to set up a sensor that indicates if there is spam mail for my mail account using the IMAP-integration.
I can get the number of mails in the folder “INBOX”, but I have yet to find the proper/valid folder name for spam-mail.
I’ve tried names like spam, Spam, SPAM, INBOX/Spam, Trash,… but these are not working (error “The selected folder is invalid”).

I’ve asked helpdesk and tried their suggestion “Spam” but this didn’t work.

Anyone any ideas?

Have you tried Junk?

RFC 6154 IMAP LIST Extension for Special-Use Mailboxes gives some standard mailbox attributes for identifying special-use mailboxes.


  • This mailbox is where messages deemed to be junk mail are held. Some server implementations might put messages here automatically. Alternatively, this might just be advice to a client-side spam filter.

I tried junk, Junk, JUNK, /junk, /Junk, /JUNK, \junk, \Junk, \JUNK but none of these were considered a valid folder.

Ok, well it was just a suggestion. Maybe contact support and tell them their suggestion isn’t working. Try to get through to second level, who usually know what they’re talking about, as opposed to first level.

I know a guy who works at and will try to ask him. He’s pretty high level though, and might find this beneath his dignity. I’ll get back to you, if he answers.

Alright, here’s what he said:

It should be under the prefix INBOX in Spam, i.e. INBOX.Spam.

This morning I got the message that it was forwarded to their Senior Technicians.

And indeed …

… is the correct folder.

Thank you very much for your time and effort, much appreciated.
And also thank your guy at

1 Like

Only happy to help. I’ll forward your thanks to the Head of Mail and Abuse at :slight_smile: