SaneBox and SpamSieve (Airmail and Apple Mail)

I moved this post from the SaneBox and SpamSieve thread. —Michael

Does this require Apple Mail or is there a way to get it to work with Airmail?

It requires Apple Mail, since Airmail is not scriptable. However, you can use AppleMail to run the script while still using Airmail as your everyday mail client.

Ok… and just to be clear, the Apple Mail Rule “SaneBox SpamSieve” should go under the “SpamSieve” rule, correct?

Does the @Sanlater script rule go under the main SpamSieve rule?

And if I am using both Mail and Airmail, should I only be running SpamSieve on one (Mail since I would like the @Sanelater box filtered) or is it ok to run it on both? The problem is, if I’m using Airmail as my main client and Mail is just doing the filtering, I’d need to train in Airmail.

The SaneBox SpamSieve rule should go at the top of the list, above the SpamSieve rule. This will make it check the mailboxes more frequently.

I have not tested this, but in theory it should work to use SpamSieve with both Mail and Airmail at the same time. It should be OK to receive/filter in one and train in the other.

Another option would be to use the drone setup with Apple Mail and then train SpamSieve from Airmail by moving messages to the Train mailboxes. Then Airmail would not need to talk to SpamSieve directly.

Ok, I’m seeing something strange and I don’t know if it has to do with the @Sanelater Script or not.

I have everything configured as it should be. In Mail I have two rules, the first one is “SaneBox SpamSieve” as you suggested and the second one is “SpamSieve” as is described in your instruction manual.

My SaneBox SpamSieve rule is:
Any “Every Message”
Run Applescript apple-mail-sandbox

The SpamSieve rule is:
Any “Every Message”
Move Message to “Spam” (where Spam is the “On My Mac” mailbox I created).

However, I’m seeing messages being moved to the Spam folder “On my mac” but they are also staying in their original location such as the @SaneLater folder. So I now have two of the same messages.

Why is this happening?

It sounds like Mail isn’t properly moving the messages. It might help to create a Spam mailbox on your server. Then the script will try to move the messages there instead of to the one On My Mac.

I was going to ask why in your instructions you specifically say to create the Spam folder “on my mac”. I wasn’t sure if there was a technical reason behind it.

However, why would Mail not be able to move mail to a local folder as opposed to a server folder? It seems like it would be the opposite if anything.

And, this appears (haven’t confirmed) to only be happening with spam in the @SaneLater folder which is why I was wondering if it has to do with that or the SaneLater script.

I did a test by sending me an email that would be triggered as spam and but NOT be in the @SaneLater box and it moved to the “On My Mac” Spam folder just fine. This appears to be only happening with @SaneLater folder emails which makes me wonder about the script.

Local mailboxes are generally faster and don’t fill up your server account, so I recommend using them unless there’s a specific reason you want the spam to be on the server.

I don’t know the full IMAP details, but I have definitely seen this to be the case before. My guess is that moving to a local mailbox is a two-step process of copying the message and then deleting the server one, and sometimes the second step doesn’t happen. Whereas moving to a server mailbox is a single “move” command.

The script is simple enough that I think we can be sure it’s telling Mail to do the right thing. However, Mail’s AppleScript support for moving messages is buggy, especially in Mavericks.

Ok, for some reason it started working properly and the message are no longer staying in the @Sanelater folder while also being moved to the “On My Mac” Spam folder. But now I’m seeing slightly different strangeness.

For some reason the Sanelater SpamSieve rule is moving spam not only from the @Sanelater folder to the “On My Mac” spam folder, but it is also sending it to the email account’s spam folder located on the server.

I saw Spam getting sent to the the server’s spam folder and couldn’t figure out how it was getting there. So I verified this by turning off the Sanlater SpamSieve rule to see if that is what was causing it. When it was off (for about 10 hours) there were no spam messages being moved to both the server spam folder. They were only being moved to the “On My Mac” spam folder. As soon as I turned it back on, I started seeing the spam sent to both folders.

The Apple Mail - SaneBox script is intentionally designed to move the messages to a Spam mailbox on the server. If such a mailbox does not exist, or an error occurs, it uses the one “On My Mac”.

Oh, ok. I changed the name of the server’s spam folder to “Junk” and I guess that will fix the problem.

It seems odd that you’d give instructions for SpamSieve to specifically create an “On My Mac” folder Spam and then make the Sanelater Spamsieve script use a server Spam folder since most people would have followed your SpamSieve instructions and already had the “On My Mac” Spam folder. Using the server side Spam folder causes confusion and duplicates… hence this thread :slight_smile:

A lot of people do want to use a server mailbox, so I tried to write the script so that it would work for both configurations.