Im struggling to make SpamSieve apply rules Ive set into iCloud Junk folder :(

Hi there,

As per title, Ive bought a Mac mini to keep on 24/7 to mainly filter my emails. I want it to scan and apply rules in my iCloud Junk folder.
I have tried too follow this link

https://c-command.com/scripts/spamsieve/apple-mail-server-junk-mailbox

I changed the account to ‘iCloud’ and folder ‘Junk’.

Ive got a long list of rules with headings I want blocked but it does not work. Ive tried many options and settings for months and I’m getting so weary. Please help me.

Thank you.

Do you mean SpamSieve blocklist rules or rules in Apple Mail’s preferences?

Is the script moving messages from Junk to Spam and/or Junk to Inbox?

I would like SpamSieve to be constantly active, and monitoring all incoming emails, especially those arriving in the iCloud Junk folder. This arriving in the Junk folder, are not being given a colour (according to how spammy it is), and the scripts I have downloaded to send off to abuse@iCloud.com are not being automatically sent.

Moreover, most of the Spam I receive are FedEx, FedEx Express, WhatsApp emails (which are not from legitimate companies but random junk senders), and in the rules I have set in Apple Mail Preferences have these key words in there to block, and send/keep it in the iCloud Junk folder.

It really does not seem to be working at all. As I said, Ive got my Mac mini running 24/7, so when I use my other Apple devices, I don’t want to be seeing Spam of any kind in mail.

Thank you for your help.

In order for SpamSieve to filter messages in the Junk mailbox (i.e. give them colors and move them to the Spam mailbox) you need to download the Apple Mail - Server Junk Mailbox script, edit it to add your account names, install the script file, and make an Apple Mail rule for it at the top of the list. You can test the script by running it in Script Editor, and it will report any errors to the Console log.

There’s no SpamSieve script for abuse@iCloud.com, so I assume you must have gotten that script elsewhere. Keep in mind that Mail doesn’t apply rules to messages in the Junk mailbox, so that may be why this script isn’t working as you expect.

When using SpamSieve, you should not have any other Mail rules for moving junk/spam messages. You should either delete or uncheck them. If you want to block certain senders, you can do so from SpamSieve’s blocklist window.

Thanks very much for the reply. See, thats the issue I have. I have downloaded and edited the script for the Server as per instructions, but it still does not appear to apply the rules to the junk folder. It seems a pretty straightforward process for the script to work, but I can’t pinpoint what is going wrong…

Im happy too send you the script Im using, and how it has been edited to apply it to iCloud Junk folder.

Please run the script in Script Editor, then e-mail me the script file and a diagnostic report.

Thanks for sending the script and report. I found a number of problems:

  1. The script is reporting the error:

SpamSieve [Apple Mail Server Junk Mailbox] Error -1728 filtering mailbox “Junk” of account “iCloud”: Mail got an error: Can’t get mailbox “Junk”.

I think this is because you have it set to move the spam messages to a Junk mailbox under On My Mac but there is no such mailbox. It’s more normal to use the default configuration of:

on mainSpamMailboxInfo()
    return {"", "Spam"}
end mainSpamMailboxInfo

which will use local Spam mailbox.

  1. Your regular SpamSieve rule does not match Step 3. You have it set to only let SpamSieve see messages that Mail’s junk filter had already caught.

  2. Your SpamSieve rule is configured to run the Apple Mail - Report Spam script. However, that script is meant to be run manually
    , and it does not function from rules.

  3. You have not disabled Mail’s junk filter (Step 7).

  4. You have an extra rule called “Rule 2” that runs the “Launch SpamSieve.scpt” when Mail’s filter finds a junk message. That script should not be used, and this rule should be deleted.

  5. You have a Mail rule called “Junk rule” that moves messages to the Junk mailbox. When using SpamSieve, there should not be any other Mail rules for moving/deleting spam/junk messages (Step 5).