Mail Rule perform following actions reversing

I have a simple rule in Mail:

1) On receipt of new eMail, run Applescript detaching attachments to local folder

2) Move Message to mailbox: Trash

When I click OK (which closes that dialog) and then re-open the rule, the event order in Perform Actions has reversed to have Move Message to Trash as first. The rule does this, of course, but then the Applescript is not run (presumably because the Message is now in the Trash). If I remove the Move-to-Trash action, the Applescript runs just fine. The reason I need the Message in the trash is because with the next incoming eMail, the rule is run on all already-received eMails, doubling up the detachments. Putting the Message in the trash means it is removed from be acted on a second time.

Has anyone seen this Mail actions reversal of order, or does anyone have a fix? Any ideas much appreciated.

macOS Sonoma, but observed this behaviour on Ventura as well.

Posted on Oct 17, 2023 6:53 AM

Reply
Question marked as Top-ranking reply

Posted on Oct 17, 2023 7:34 AM

This looks like a new bug in Sonoma. The actions are executed in the same order than they appear in the list of actions to choose from, not in the order the user organized them.


Solution: put the trashing in the script itself. It will have the additional benefit of ensuring the script has properly executed before getting rid of the message.

Similar questions

3 replies
Question marked as Top-ranking reply

Oct 17, 2023 7:34 AM in response to thellum

This looks like a new bug in Sonoma. The actions are executed in the same order than they appear in the list of actions to choose from, not in the order the user organized them.


Solution: put the trashing in the script itself. It will have the additional benefit of ensuring the script has properly executed before getting rid of the message.

Oct 17, 2023 8:11 AM in response to Recycleur

It's not actually new to Sonoma. I saw the same behaviour under Ventura, FWIW.

But you're correct, putting the trashing within the AppleScript is better. But I am not skilled enough in AppleScript to add this to my existing script. The script as it stands is:


#Evaluate 1 minute's worth:


set saveLocus to (path to documents folder as text) & "ChartsIn:"


tell application "Mail"


set arbitraryTargetsbydate to inbox's messages whose date received comes after (((current date)) - 1 * minutes)


repeat with aMessage in arbitraryTargetsbydate


set theAttachments to aMessage's mail attachments


if theAttachments ≠ {} then


repeat with anAttachment in theAttachments


set itsName to name of anAttachment


save anAttachment in file (saveLocus & itsName)


end repeat


end if


end repeat


end tell

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 Rule perform following actions reversing

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