Note: this is a migration of https://apple.stackexchange.com/questions/249495/download-recent-mail-headers-and-sometimes-full-messages
I'm trying to run a script on the body of an email message.
What I'm looking for
I'm looking for a program that's either already installed on default OS X installations, or is easy to install on a wide variety of OS X versions (e.g. doesn't require homebrew, which itself requires the "OS X Command Line Tools", which are a couple of gigs IIRC).
My Plan
I'd like to download all message headers from an Outlook/IMAP server, and then (when I see a specific subject line), download a full message, preferably in text/plain if possible.
What I've tried
- Using the Outlook integration in Automator
- This won't let you trigger actions when you see a message with a specific subject, because it uses Spotlight's search, which (as far as I could tell) doesn't support searching by subject only
- Using Outlook rules
- You can't run arbitrary code in Outlook for Mac, only in Outlook for Windows (I had a vbscript that I'd written to export the messages to disk and kick off the script).
- There doesn't appear to be another way to run commands or otherwise run code in Outlook for Mac