Mail Rules - Mannually Work - Don't Run Automatically New Mail

Hello:


On OS X 10.9.4 - I can not get an Apple Mail Rule to run Automatically when new Email arrives. I can manually apply the Rule and it works. I can make a changes to Rule, such as Bounce Icon, and apply the change and the Rule works. But the Rule will never run Automatically when new Email arrives.


I have only one Rule, so there is no interference from other Rules. I have tried setting the one Rule to look at only the one Email Account (a POP account) the rule applies to. The account is unique to computer running the Rule. No other computer system accesses or uses that POP Email Account.


I have tried suggestion of setting condition of "Every Message". Also setting Mail from Automatic to Check every Minute. Still no Joy.


Rebuilding Mailboxes of all accounts, including Account the Rule involves did not help. Deleting all the Rule plist files and allowing Mail to recreate those files, then remaking one Rule did not fix the problem.


The one Rule does run an AppleScript which looks at Emails, grabs Subject line, and passes Subject line onto a Shell script. Perhaps, the Rule won't run Automatically do to some bug in AppleScript, but runs perfectly fine when the one Rule is invoked Manually?

Although I have tried about three different versions of the AppleScript, and none will run Automatically, but the would run when the one Rule is invoked Manually...



One of the tried AppleScripts set to run by the one Rule...

______________________________________________________________

using terms from application "Mail"

on perform mail action with messages theMessages for rule theRule

tell application "Mail"

repeat with eachMessage in theMessages

set this_subject to subject of eachMessage

log this_subject

do shell script "afplay '/System/Library/Sounds/Basso.aiff'"

do shell script "/bin/ksh /Users/astirusty/Read_Test/Mail_Run.tst " & quoted form of this_subject

end repeat

end tell

end perform mail action with messages

end using terms from

______________________________________________________________


Thanks,

astirusty

Posted on Jun 18, 2015 5:14 PM

Reply
7 replies

Jun 18, 2015 10:25 PM in response to astirusty

Copied AppleScript to another system running Yosemite 10.x

Created a fresh Email Rule to invoke AppleScript.


Same problem. Rule is not automatically invoked on new Incoming Email.

Rule can be manually run and AppleScript works.


Also tried commenting out the "do shell script" in AppleScript. Didn't help.

Apple Mail is not running the one Rule automatically when new Email matching conditions arrives.


Something is amiss with Rules being invoked automatically...

Jun 20, 2015 8:34 PM in response to astirusty

Workaround - if possible switch email account from POP to IMAP

Thus far it appears... Mail will automatically apply the Rule and run the Applescript IF incoming emails come from an account setup as IMAP.


No Google searches indicate that Mail Rules running Applescript require incoming emails to come from IMAP account.

Numerous Google searches turn up just opposite.

Mail Rules running Applescript often fail when emails come from IMAP account, while working when emails come from POP account.

Apr 15, 2016 6:10 AM in response to astirusty

This may help:


I'd been having problems with running scripts as part of Mail rules. I'd given up a few months ago having gone round in circles, getting nowhere. I decided to try again, having found a solution to scripts not running as iCal alerts and I came across Mail (Yosemite): Use scripts as rule actions.


Basically, the scripts need to be located in ~/Library/Application Scripts/com.apple.mail


Once located there they can be selected from the dropdown menu when you create your Mail rule.


I'm using 10.11.4 so it may be different for 10.9 but the change was made from 10.8 onwards.


When I first started using applescript, way back in Tiger, it was all so straightforward. You wrote scripts, they ran. Now there seem to be scores of hidden reasons that your scripts just won't execute when you want them to, or scripts that work fine in Script Editor that won't work when called by applications.

This thread has been closed by the system or the community team. You may vote for any posts you find helpful, or search the Community for additional answers.

Mail Rules - Mannually Work - Don't Run Automatically New Mail

Welcome to Apple Support Community
A forum where Apple customers help each other with their products. Get started with your Apple Account.