I work at a lot of universities. Each insists that I use their email account, making email management in Apple Mail tedious, especially archiving. So I created an Apple Shortcut just for archiving. I push a button on the stream deck to pop up a window with the list of my various accounts. I select an account, and the shortcut moves the currently viewed email to that account's archive folder. It works, but it doesn't save all that much time over simply navigating a few hierarchical menus. I could easily create separate shortcuts for each account and assign each shortcut to a different stream deck button, but "hard" coding a macro for each account would complicate changes in the future.
I'm wondering if I couldn't use a Keyboard Maestro macro to automatically archive email according to the domain name in the Sent From email address. If "mac.com" then move to the mac.com archive. If "uni1.ac.jp" then move it to that archive. And so on for all six accounts. That way, if I add a new account, I needn't add or change a macro.
I've looked through the available actions, but see nothing that will return the domain name of an email address, much less move an email to a specific archive. (In fact, there seem to be very few actions associated with email.)
Any ideas on how I can view an email, then trigger a macro to move that email to that domain's archive folder? Thanks!
Keyboard Maestro does have some Tokens to work with Mail.
%MailSender% will return the email address of the sender of the currently selected message.
Keyboard Maestro can also make use of Mail's menu commands to move selected messages to certain folders.
And it can use a Switch Case Action to do different things depending on what the Token returns.
So, it is possible to build a Macro to move a selected message to a certain folder in Mail depending on the domain is was sent from.
I am assuming you have a single archive folder somewhere for all mail received from a certain domain? In which case you would only have to check the sender's address. Here is a kind of template example:
EDIT: You've probably already thought of this, but if you wanted to completely automate the process you could maybe do that with Apple Mail's inbuilt rules? You could have a rule that moves messages to archive folders, depending on the sender's address, after say a week. Of course this would give you less manual control.
Tokens...didn't know about tokens in KM. Didn't know about Switch Case. (What I don't know about....well, everything, really.) But yea, I think those'll do the trick quite nicely. Thanks!
As for Apple Mail rules, it would work, but those uni emails have various half-lives, so I couldn't automate archiving in that way. Your Tokens/Switch Case solution provides control as well as efficiency.
Still awaiting the predicted death of email. But don't see anything even close to replacing it. Oh, well.