Running Automator Workflows from Mail Rules
- Getting Started: Creating a Workflow Folder
- Preparing a Mail Rule Workflow
- Preparing a Mail Rule Script
- Configuring a Mail Rule
- Testing Your Mail Rule Workflow
- Conclusion
If you're an Automator user, you're probably aware that it's possible to save an Automator workflow in a variety of ways. At the basic level, a workflow can be saved as a workflow file that can be opened in Automator, or as an application that can be launched and run like any other application. At a slightly more advanced level, Automator workflows can be saved as plug-ins for certain applications and processes, including the Mac OS X Finder, iCal, Image Capture, PDF printing services, and more.
Presently, Automator doesn't offer a way to save workflows as plug-ins for Mail, to be run when new email messages arrive. However, you can add this ability yourself. To do so, you'll need the help of a Mail rule, some AppleScript, and an Automator workflow. Let's walk through the process.
Getting Started: Creating a Workflow Folder
You'll need somewhere to save your workflows so they can be found and run when new messages arrive. Begin by creating a folder called Mail Rules in the ~/Library/Workflows folder in your home folder. If you don't have a Workflows folder in your ~/Library folder, go ahead and create that, too (see Figure 1).
Figure 1 The ~/Library/Workflows/Mail Rules folder.