- I've created some rules in my Mail.app to change background color of specific messages
- And also I've created rules in the mail server to move specific messages to some folder
For messages in the Inbox folder everything is fine.
But if message has been moved by server rule into another folder, then rules in the Mail.app do not apply (and for some twisted reasons this is by design: https://support.apple.com/kb/PH19162?locale=en_US&viewlocale=en_US).
And if I apply rules manually by hitting
Command + Option + L, then Mail.app rules will apply as they should.
I want to automate this action. Is it possible to achieve with Apple Script? Can you help me with it? The steps should be as follows, I guess:
- Choose Smart Folder "today";
- Select all messages in this folder;
- Perform the action "Apply Rules" for selection.
using terms from application "Mail" tell application "Mail" set the message_count to the count of HOW-TO-GET-MESSAGES-FOR-TODAY-SMARTBOX repeat with i from 1 to the message_count set this_message to item i of MESSAGES-FROM-TODAY-SMARTBOX tell this_message -- here goes something like APPLY RULES end tell end repeat end tell end using terms from
If it's not possible for Smart Folder, then I want to do it will all the messages in all mailboxes (or with messages in specific mailbox (or just for any new message regardless of folder)).