How to Disable Remote Content in Junk Mail Folders in the MacOS Mail App

I just spent a whole afternoon trying to figure out how to get the stock MacOS Mail app to show images automatically except in the Junk folder(s). I finally got it, so I’m sharing my results for anyone else who would benefit from this.

Note: this solution depends on the app Keyboard Maestro, which I use heavily in my daily workflow.

The Mail Preferences pane (under “Viewing”) gives the option to “Load remote content in messages” or not, regardless of the folder. (By default, it hides remote content, including images, in mail the app itself considers junk, but that is pretty limiting and will not play nicely with any external spam filtering.)

There did not appear to be any built in AppleScript support for changing this option without interacting with the preferences pane, but it turns out there is; it’s just not officially documented. The option is called download html attachments in AppleScript. So, all you need is a couple of if actions to figure out whether to toggle the setting and a few lines of AppleScript to toggle it when necessary.

Here’s my macro:

Note: one piece of this got cut off, namely the text in the second if condition. The text that got cut off is:

^(General|Accounts|Junk Mail|Fonts & Colors|Viewing|Composing|Signatures|Rules)$

This prevents the setting from changing just because you have the Preferences open.

I hope this helps somebody else! Feedback is welcome.

Leave a Reply

Your email address will not be published. Required fields are marked *