Mail (Yosemite): Use scripts as rule actions

This article has been archived and is no longer updated by Apple.
You can attach an AppleScript script to a Mail rule. For example, you could have an incoming message trigger a script that copies information from the message and pastes it into a database that works with Script Editor.
  1. Choose Mail > Preferences, then click Rules.

  2. Select an existing rule to edit, then click Edit. Or click Add to create a rule.

  3. Choose Run AppleScript from the “Perform the following actions” pop-up menu.

  4. Choose a script from the pop-up menu of scripts that are located in ~/Library/Application Scripts/com.apple.mail. Or choose “Open in Finder” to open the folder so you can copy a script into it.

    If you later move or rename the script, your rule will not work.

  5. Click OK to save the rule.

If you used scripts in Mail rules in OS X Lion or earlier, then the first time you open Mail in OS X Mountain Lion or later, your scripts are moved to ~/Library/Application Scripts/com.apple.mail, and your rules are updated with the new location. To show your home Library folder, hold down the Option key, then in the Finder choose Go > Library.

If you use iCloud Drive, your rules are available on your other Mac computers that have iCloud Drive turned on. Scripts attached to rules aren’t available. For more information, see Store documents with iCloud Drive.

Published Date: Sep 15, 2017
Helpful?