C-Command Software Forum

Preventing loading images

Been using SpamSieve for 4 years, love it. Help me understand the difference between SS marking as spam and Mail.app ‘mark as junk’ when it comes to preventing loading of images.

The desired behavior is that anything that SS finds and sticks into the Spam folder, should be automatically marked as Junk from mail.app’s perspective, and therefore should display the Load Images banner on top.

What happens for me is that mail gets processed correctly, put into my Spam folder and color coded. But the Load Images banner doesn’t appear. And the messages don’t have Junk icons on them. I really don’t care about the junk icons part, or what mail.app thinks of the messages. But I do want the Load Images banner to appear so I’m not loading web bugs.

My Spam bucket is on the server (Exchange, if it matters), not local, so that I can review the spam on the road if needed. I also use remote spam/good training. The spam folder path is “Inbox/Spam”. Does it need to be at the root level? Does it need to be named something special? Is there anything else I need to do to get the Load Images banner and prevent images from auto-loading?

The normal way of using SpamSieve is only to train messages as spam. The instructions ask you to turn off Mail’s junk mail filter, which hides the junk icons and disables the junk menu commands. However, when you train SpamSieve it also trains Mail’s built-in filter so that it remains up-to-date and provides the desired image-loading behavior.

Right.

Is your question about messages that SpamSieve caught automatically or the ones that you trained as spam? If the latter, how are you training the messages as spam?

Currently the remote training script does not mark the messages as junk, however I can probably address this in a future version. It assumes that the spam mailbox is called “Spam” and is at the top-level. Are the messages being automatically moved out of your TrainSpam mailbox?

Yes, I’m happy with how SS works. I do not use the Mail.app Junk feature. The issue is that messages that are automatically moved into the Spam folder don’t get marked in such a way to make the Load Images banner appear. So when I review the Spam folder, any time I select a message, images appear, and web bugs get potentially triggered. The desired behavior is that any message in the Spam folder should have that banner and not load images.

So, to achieve that, is there something I need to fix? Does my Spam folder need to be local? In the root? Renamed to “Junk” or something else?

That should be happening automatically, unless you had changed the AppleMailPlugInSetIsJunk esoteric preference. What do you see if you enter this command in Terminal:

defaults read com.c-command.SpamSieve AppleMailPlugInSetIsJunk

?

Well, that domain/default pair wasn’t found. Interesting. I did find two different SpamSieve plist files. One is in the usual place, ~/Lib/Pref, and the other one is in ~/Lib/Mail/SpamSieve/ and had some AppleMail stuff in it:

<key>AppleMailLocalSpamMailbox</key>
<string>NO</string>
<key>AppleMailSkipSignatureCheck</key>
<false/>
<key>AppleMailTrainGoodMove</key>
<string>YES</string>
<key>AppleMailTrainGoodUnread</key>
<string>YES</string>
<key>AppleMailTrainSpamName</key>
<string>Spam</string>
<key>AppleMailTrainSpamRead</key>
<string>NO</string>
<key>AppleMailUsesColors</key>
<string>YES</string>

Should I add a new one for this?
<key>AppleMailPlugInSetIsJunk</key>
<string>YES</string>

That’s to be expected; it means the default (YES) isn’t overwritten.

That’s not necessary.

Since SpamSieve is set to mark the messages as junk, it’s not clear to me why Mail would be displaying the images. Are they perhaps not remote images?

I suppose there could also be something weird going on with your server. Does it help if you set the SpamSieve rule to use a Spam mailbox “On My Mac”?

I tried a bunch of different scenarios. Luckily I get so much spam during the day, that I could get results in real time. :slight_smile:

If I use a local folder, same thing (loads images).

If I use a different server folder, still loads images.

If I turn ON the Mail.app junk mail filter, and mail arrives that Mail.app considers spam, it gets marked as junk (junk bag icon appears, images are prevented from loading). But, as soon as SS processes that same email, the junk icon disappears and it gets color coded. So it appears that SS is specifically (intentionally or not) removing the junk-mail flag instead of making sure it’s there.

How is it that you are seeing the messages after they arrive and Mail’s filter has processed them, but before Mail has applied the rules to them? I would expect this to happen all at once.

So what I did was turn on Mail’s filter, but told it not to move the messages. And to detect junk before processing rules. What happens is that a junk comes in, turns brown (per mail.app), gets a junk icon, stays in the inbox. Then, the SS rule fires and the mail gets moved to the spam folder, the icon goes away, it gets re-colored grey/purple/whatever.

I also ran an applescript to examine the ‘junk mail status’ property of each message in the spam mailbox, the stuff that SS processes. It’s false. If I programatically change the status to true, then the Load Images banner appears as expected. So I suppose, as a workaround, I could run a script that goes through and sets all the messages junk status to true, but this should be happening automatically.

tell application "Mail"
    set theSelectedMessages to messages in mailbox "Inbox/Spam" of account "XYZ"
    repeat with _message in theSelectedMessages
        set _junk to junk mail status of _message
        display dialog _junk
        set junk mail status of _message to true
    end repeat
end tell

That’s interesting because SpamSieve should be programmatically setting that property to be true. Please contact me via e-mail, and I’ll get you a debug version to try to figure out why this isn’t working on your Mac.

Perhaps a workaround would be to add a script action to the SpamSieve rule:

using terms from application "Mail"
    on perform mail action with messages _messages
        tell application "Mail"
            repeat with _message in _messages
                set junk mail status of _message to true
            end repeat
        end tell
    end perform mail action with messages
end using terms from

For some reason that we have not been able to determine, SpamSieve is correctly setting the messages’ junk mail status, but it is only getting saved for spam messages stored “On My Mac”. So rhanson has changed his SpamSieve rule to move the messages to a local Spam mailbox. He’s using an AppleScript to move them from there to his server-side Spam mailbox. I think a rule script such as described in the previous post would also work.