Toggle HTML parsing in Mail with a simple AppleScript

Feb 21, '03 10:17:00AM

Contributed by: nvdingo

Since this hint was posted ("Add an HTML filter to catch more spam in Mail.app"), I turned off the download HTML images option in my Mail.app preferences.

But sometimes, I get HTML formatted mail from trusted sources that I want to see. I was getting tired of the round trip to the prefs to turn it on, let it download for viewing, and turning it back off. So I checked the AppleScript dictionary for Mail.app. The solution was incredibly simple. I created the following script and put it in my Scripts menu (which i had activated a long time ago):

  tell application "Mail"
    set download html attachments to true
    delay 2
    set download html attachments to false	
  end tell
It switches the pref, waits two seconds, and switches it back. Two seconds is long enough for it to download the HTML parts (or at least start) for the email you are currently viewing. Mail doesn't store the HTML parts, so if you switch messages and come back, you will be back to the blocked version.

I then remembered that I had downloaded and installed YoupiKey, so I pasted the script into a new shortcut, set it to cmd-shift-H, and am now very happy.

Comments (5)


Mac OS X Hints
http://hints.macworld.com/article.php?story=20030218133745429