Help with automatically running Mail rules

I want to use mail flags (which I apply to messages in Mail on my iPhone) to trigger Apple Mail on my Mac to filter messages. I've set up this Macro but only rarely runs "by itself" even though KM says that the condition is true.

Is this set up wrong or is there an issue with Mail or KM?

It seems mail only applies the rules to selected messages... any suggestions to get around this?

Which emails do you want the rules applied to ?

I would caution heavily against running that macro every 10 seconds ad infinitum. It will probably make every electron flowing through your computer cry.

Ha, good point... I set it at 10 seconds while I was fiddling with it to see why it was running inconsistently... I've now narrowed it down to the fact that rules only get applied to selected emails...

My process is:

  1. On iPhone: Flag an email that requires some action on my part
  2. On Mac: Have apply inbox rules at regular intervals to pick up the flagged messages and run a series of rules on them (forward them to my task manager, add a tag, change color, then file them in an @Action folder – I use MailActOn for this)

I don't know AppleScript well enough to write a script to do this, so KM macro and MailActOn. It seems weird to add a step to KM macro to select all messages, but there doesn't seem to be a way to get this to work unattended.


You will need a tiny AppleScript in order to select desired messages. If I'm understanding you correctly, the rules are to be applied to flagged messages ?

After flagging message on your iPhone, and assuming you're using the IMAP mail protocol, the message should be flagged on your Mac when the mailboxes are next synchronised.

You can trigger synchronisation and selected the flagged messages using AppleScript, I believe (although I don't use Mail myself, so can't really test this).

tell application "Mail"
    repeat with A in every account
        synchronize with A
    end repeat

	set flaggedmsgs to the messages of the inbox whose flagged status = true
	set selected messages of message viewer 1 to the flaggedmsgs
end tell

Thanks, will give this a try!