I want to trigger a workflow in automator every time I receive a new email in "mail.app". How can this be done?
Automatically Trigger Automator through mail
automatormail.app
automatormail.app
I want to trigger a workflow in automator every time I receive a new email in "mail.app". How can this be done?
Best Answer
Yes it can:
You can use the normal Mail rules with a perform action: Run Applescript.
Create a normal Mail rule applescript. But include code to call your automator workflow via the unix command /usr/bin/automator.
The /usr/bin/automator command will run the workflow you point it at and optionally can pass input onto the workflow using the -i option.
Here is a quick example of a Applescript Mail rule which gets the subject of the email/s and runs a automator workflow that speaks any text passed on to it. In this case the email subject.
The script MUST be saved in: your
~/Library/Application Scripts/com.apple.mail
folder for mail.app to see them.The example Applescript for the Rule
(Change the workFlowPath property to reflect the full path to your Automator workflow file)
The Automator workflow is simply