astirusty

Q: 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

Close

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

  • All replies
  • Helpful answers

  • by astirusty,

    astirusty astirusty Jun 18, 2015 10:25 PM in response to astirusty
    Level 1 (0 points)
    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...

  • by astirusty,

    astirusty astirusty Jun 20, 2015 8:34 PM in response to astirusty
    Level 1 (0 points)
    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.

  • by zantafio,

    zantafio zantafio Feb 23, 2016 4:35 AM in response to astirusty
    Level 1 (4 points)
    iBooks
    Feb 23, 2016 4:35 AM in response to astirusty

    I had the same problem and came to the same conclusion as you did: applescript will not work on POP account, the messages object is empty, it contains data only with an IMAP account.

     

    Now if only somebody knew the direct email to whoever is in charge of Mail at Apple...

  • by Eric Root,

    Eric Root Eric Root Feb 23, 2016 7:24 AM in response to zantafio
    Level 9 (69,630 points)
    iTunes
    Feb 23, 2016 7:24 AM in response to zantafio

    Send Apple feedback. They won't answer, but at least will know there is a problem. If enough people send feedback, it may get the problem solved sooner.

     

    Mail Feedback

  • by Gasman99,

    Gasman99 Gasman99 Apr 15, 2016 6:10 AM in response to astirusty
    Level 1 (4 points)
    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.

  • by jastus,

    jastus jastus Jun 7, 2016 3:13 PM in response to Gasman99
    Level 1 (4 points)
    Jun 7, 2016 3:13 PM in response to Gasman99

    Nope.  I found this thread in a Google search to find out why I'm having this very problem.  I'm running 10.11.5 and the script I'm trying to execute is in ~/Library/Application Scripts/com.apple.mail, and I get the same behavior as the OP.  The script runs fine if manually triggered, but not automatically.

  • by syberknight,

    syberknight syberknight Aug 7, 2016 3:11 PM in response to jastus
    Level 2 (193 points)
    Mac App Store
    Aug 7, 2016 3:11 PM in response to jastus

    DITTO!!!