I just spent a whole afternoon trying to figure out how to get the stock Mail app to show images automatically except in the Junk folder(s). I finally got it, so I'm sharing my results here.
The 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 second
if condition. The text that is 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.