Automating the "Load Content Directly" button in Mail

In macOS Monterey, there is a feature in Privacy settings to “Protect Mail Activity” and “Hide IP addresses.” When checked, they do not load images jn emails unless you click on a button labeled “Load Content Directly.”

I do want this feature turned on as I want to control when images load as opposed to them loading automatically. But clicking on the button gets tedious. Has anyone either found a way to script the button or assign a keyboard shortcut? Ideally, I want to assign a Stream Deck button to having the button clicked.

Update: As is often the case, once I posted this I realized I knew what to do. In Keyboard Maestro I used the Click Image action with a screenshot of the button to make a one-action macro and then created the KM Link Stream Deck plugin to assign it to a key.

2 Likes

I’ve long used an AppleScript, with a keyboard shortcut added using FastScripts, to accomplish this. The code is … too convoluted to share, owing to changes in Mail.app over the years. Keyboard Maestro is definitely the better way to go.

One thing to know about Mail.app in Monterey is that there are two different text labels that can be used in the Load button, depending on your privacy settings.

  • “Load Content Directly” as you’ve described
  • “Load Remote Content”, if you have different privacy settings

I use a pihole for my DNS, and that prevents Apple’s newest privacy settings from working (pihole is more strict). As a result, I normally turn off the first two items in Mail Privacy Protection, since they just result in an irritating message about “your network doesn’t support blah blah blah”. This results in the Load button’s label text changing, which might require an adjustment to your KeyboardMaestro macro. (It certainly does in the AppleScript.)

1 Like

AppleScript would probably fix the biggest flaw in my quick solution which is that after using the button once, the cursor is now on top of the image and the macro will sometimes fail to see the image. I will have to fiddle with moving where the cursor clicks the button to see if that fixes it.

Since I don’t plan to turn off Protect Mail Activity (and if I do the images load automatically anyway), I’m not worried about the alternate button problem, but it’s good you bring it up for others.