Server Junk Mailbox script - does not put each account's spam in separate mailbox

Regarding the “Apple Mail - Server Junk Mailbox” script (https://c-command.com/scripts/spamsieve/apple-mail-server-junk-mailbox) …

I have multiple email accounts. For each account I want the script to do the following: evaluate each message in the account’s server Junk mailbox and put good messages in the account’s In box and put spam messages back in the account’s server Junk mailbox (after color-coding them).

I configured accountAndServerJunkMailboxNames() and set pPerAccountSpamMailboxes to “true”, but this puts the spam from all accounts into the single mailbox specified in mainSpamMailboxInfo().

Perhaps I have misunderstood the intended function of the pPerAccountSpamMailboxes switch. Please let me know if there is a way to achieve what I described above. Thank you.

That’s not how it works. The new messages and the ones that SpamSieve has already checked need to be in separate mailboxes. For example, you could have it move the spam messages from Junk to Spam.

It will fall back on using the main Spam mailbox if the per-account name specified in the script doesn’t exist. You could check Console for errors that say “Apple Mail Server Junk Mailbox”.