Import from Apple Mail and Sleep

I’m trying to automate importing messages from Apple mail. I’m finding that the “Import from Apple Mail” script only works if the computer is awake. Unfortunately it won’t auto run after waking up.

If I set up a rule that runs that AppleScript and then deletes the message, I think that if the puter is asleep it will end up just deleting the message,

Anybody have ideas or workarounds for this?

It is true that Mail rule actions aren’t always fully applied when the Mac is in Power Nap. You could turn off Power Nap or quit Mail when you sleep your Mac. Or, instead of having the rule delete the messages, you could set it to move them to a “To Import” mailbox. And then you could periodically import the messages in that mailbox into EagleFiler.

Kinda sux, however…

Keyboard Maestro to the rescue! I have set up a “Quit Mail” on system sleep macro along with a “Start Mail on Wake” macro.

I will test to see how that works and IF it works reliably then I will add a “delete message” step after the 'import to apple Mail" script has been triggered.

Fingers crossed!

Good workaround. And SpamSieve actually has a built-in esoteric preference called QuitMailWhenMacSleeps that will do this.