Train as Spam command does not "mark as Junk Mail" in OS X Mail

For a good while now I have been noticing that the false negatives that I run the “Spam Sieve - Train as Spam” command on in Yosemite Mail don’t get “marked” as “Junk Mail” in Mail. They do get sent to the Spam folder where they join the thousands of correctly-identified spam messages. The messages which SpamSieve correctly identifies as spam do get “marked” as “Junk Mail” by Mail.

This causes two minor problems:

  1. images in the missed spam aren’t prevented from loading
  2. I have a Mail Act-On rule that applies only to “Junk Mail”, so it misses these messages

SpamSieve 2.9.24
Mail 8.2 (2104)
Mail Act-On 3.2.4b2284
OS X 10.10.5

Thanks!

Did you perhaps change the AppleMailChangeJunkStatus esoteric preference?

You can also click this link to enable some debug logging to Console so that when you train a message as spam you can see what’s happening with the junk status.

Thanks, Michael.

It doesn’t look like AppleMailChangeJunkStatus was previously spec’d in ~/Library/Preferences/com.c-command.SpamSieve.plist, but now it’s explicitly set to YES. Debug logging has been enabled. We’ll know within the fortnight if it worked!

Hi Michael,

My first test case arrived this morning. No dice, the false negative did not get marked as Junk Mail. Here’s the Console log:

27/05/16 8:42:31.649 AM userInQuestion[609]: SpamSieve Apple Mail Plug-In [Train as Spam] Trained message as spam: hello D
27/05/16 8:42:31.663 AM userInQuestion[610]: SpamSieve Apple Mail Plug-In [Train as Spam] Changed background color to gray: hello D
27/05/16 8:42:31.667 AM userInQuestion[611]: SpamSieve Apple Mail Plug-In [Train as Spam] Message is not in Spam mailbox: hello D
27/05/16 8:42:31.686 AM userInQuestion[612]: SpamSieve Apple Mail Plug-In [Train as Spam] Will move message from “DH master 20140110” / “INBOX” to “On My Mac” / “Spam”: hello D
27/05/16 8:42:31.838 AM userInQuestion[613]: SpamSieve Apple Mail Plug-In [Train as Spam] Message is now in “On My Mac” / “Spam”: hello D

Any and all insights appreciated. Thank you!

Assuming that AppleMailChangeJunkStatus is not disabled, this log seems to indicate that SpamSieve skipped changing the junk status because Mail’s Activity window showed that it was busy with other operations. This is a workaround that I added years ago because experience had shown that there was a Mail bug that could cause it to hang if the junk status was changed when Mail was not idle—the thinking being that a hang is much worse than not telling Mail that a message in the Spam mailbox is junk. I think the workaround is no longer necessary with Mac OS X 10.11, and SpamSieve no longer uses it for that version, but it’s still in place on 10.10.

Regarding the original problems that you reported:

  1. Isn’t it too late, anyway, for false negatives? You’ve already clicked on a message that was not thought to be spam, so the images have loaded, and you’re not likely to click on it again after the message has been moved to the Spam mailbox.
  2. Are you applying Mail Act-On rules to messages in the Spam mailbox?

The “AppleMailTrainSpamGUIScripting” preference is now set to “YES”. I’ll report back when the next false negative comes in. Fingers crossed and thanks again.

  1. Isn’t it too late, anyway, for false negatives? You’ve already clicked on a message that was not thought to be spam, so the images have loaded, and you’re not likely to click on it again after the message has been moved to the Spam mailbox.

For what it’s worth, most of the time these false positives are obvious in Mail’s message preview pane, so I will usually slide the message viewer closed before selecting the message and running the Train as Spam command thus avoiding (I hope) loading the inline images.

  1. Are you applying Mail Act-On rules to messages in the Spam mailbox?

Yes, but I trigger it manually. Screenshot below for the curious. I look over my Spam folder every few weeks for false positives. I sort by sender, and I seem to get multiples of most spam templates, so where one message from “Amazon Rewards” might look like a false positive, 20 in a row is obviously spam. Once in a blue moon I find a false positive.

Mail-Act-On-trash-junk-mail.jpg

Could you explain why you need the “Message is junk mail” condition? Aren’t the messages known (to you) to be spam at the point when you trigger it?

Fixed!
Just a quick note to say that manually trained spam is now being marked, correctly, as “Junk Mail”. I’m pretty sure it was the 2.9.25 update that fixed it. Cheers!