Accounts are downloading Spam messages via POP when marked as Junk in IMAP

I have an interesting use case that I’m having issues with when using SpamSieve. I’m running a MacOSX server (10.11) that I’ve installed SpamSieve (2.9.28) on to filter all mail for incoming addresses in our house. I have the accounts in Apple Mail set up as IMAP, and have separate local mailboxes for each account’s spam. The filtering is working fine. All individual computers in the house are using running 10.12 and using Apple Mail with their respective accounts set up as POP, so as to download local copies and remove them from the server (after 30 days since mobile devices also access everything via IMAP), thus keeping mailbox sizes down on the server while allowing users to keep copies of their messages indefinitely.

The problem I’m running into is this: when SpamSieve (or anything, I think) deletes a message on an IMAP account, or moves it to a different mailbox, from a POP standpoint it’s still technically in the INBOX (just marked as deleted or in a different folder), and therefore gets downloaded when users are on their own computers. I can verify this by logging in via webmail. In my Inbox I see all the messages SpamSieve marked as junk still there, but grayed out with a line through them. I don’t see them in the Inboxes on my server, nor in any mobile devices. I’m trying to determine whether this is an issue with SpamSieve and how I have it set up, AppleMail and what it’s doing to the messages on the server, my server’s email configuration, or a combination of any or all of them. When I first set this up years ago it was working fine, but now I’m deleting all these messages twice. What I want to have happen is when SpamSieve marks something as junk, it gets moved to the appropriate local folder and then completely deleted from the server immediately. If I get a false positive and have to train it, then it can get moved and copied back up.

I tried using a server-side Spam folder instead of the default local one (which gave the added benefit of seeing Spam messages while on mobile in case something got caught unintentionally), but that presented the same issue. From an IMAP standpoint the messages were in another folder, but I think POP treats everything that’s not in Drafts/Sent/Trash as in the INBOX, so it was all downloaded.

One of my accounts has been getting hammered with Spam recently, so the process of re-deleting everything has grown time consuming and cumbersome. Anyone have any thoughts or suggestions?

I think Mail doesn’t tell the server to expunge the deleted messages right away (in general, not just with SpamSieve). It’s possible that there is a server setting that you could override this with.

That’s what I was going to suggest because when Mail moves the message to another IMAP mailbox, it will get removed from the inbox. Whereas moving to a local mailbox is seen as deleting from the server, so it leaves behind the “marked as deleted” message.

Two more ideas:

  • Make sure that the account’s “Mailbox Behaviors” are set to use a Trash mailbox on the server. That might get Mail to move the message out of the inbox.
  • It might work to use the server Trash mailbox as your spam mailbox. Messages there might be hidden from POP.

That said, stepping back a bit, I think you are trying to use POP to do something that it wasn’t really designed to do. I would encourage you to try to find another workflow that relies on IMAP, which is intended for multiple computers/devices. For example, perhaps you could create a rule that copies the messages to a local mailbox so that the messages remain after being removed from the server. Or perhaps you would want to periodically archive the IMAP messages (e.g. using EagleFiler) and then clean them off the server.