This is very useful, but there's a problem.
The menu mutates if/when you change what mailbox folders are revealed in Mail.app, therefore you cannot reliably assign keyboard shortcuts to items using KM's Select or Show a Menu Item action.
It may or may not be possible to assign keyboard shortcut using the macOS Keyboard System Prefs by using only the mailbox name and not the menu path – but I have not tested it and don't know if it can stand up to the menu mutation.
The task can be done via AppleScript:
--------------------------------------------------------
# Auth: Christopher Stone
# dCre: 2022/03/21 21:05
# dMod: 2022/03/21 21:05
# Appl: Mail
# Task: Move Selected Messages to a Designated Mailbox
# Libs: None
# Osax: None
# Tags: @Applescript, @Script, @Mail, @Move, @Selected, @Messages, @Designated, @Mailbox
--------------------------------------------------------
tell application "Mail"
set destinationMailbox to mailbox "Email Lists/TEST!" of application "Mail"
set selectedMessageList to selection
repeat with theMessage in selectedMessageList
move theMessage to destinationMailbox
end repeat
end tell
--------------------------------------------------------
Here's how to get a usable reference to a selected mailbox in Mail:
--------------------------------------------------------
# Auth: Christopher Stone
# dCre: 2022/03/21 21:08
# dMod: 2022/03/21 21:08
# Appl: Mail
# Task: Get a reference to the Selected Mailbox.
# Libs: None
# Osax: None
# Tags: @Applescript, @Script, @Mail, @Get, @Reference, @Selected, @Mailbox
--------------------------------------------------------
(*
NOTES:
• Smart Mailboxes are NOT supported.
• Select only 1 mailbox in the mailboxes panel of a mail-viewer window.
• Use the Apple 'Script Editor.app' or Script Debugger to acquire the reference.
- Script Debugger & SD (Lite/Free) ⇢ https://latenightsw.com
- The lite/free version is part and parcel of the main app.
- The mail app reverts to lite after a set demo period.
- SD and & SD Lite eat the Apple Script Editor for lunch.
*)
--------------------------------------------------------
tell application "Mail"
tell (some message viewer whose index is 1)
set theMailbox to item 1 of (get selected mailboxes)
end tell
end tell
--------------------------------------------------------
Since you can get the content of a message with Mail it's possible to write a script that can automatically file a message to different mailboxes based on a wide variety of criteria.
I have used Mail Act-On from SmallCubed Software in combination with MailHub for this sort of job.
Unfortunately Mail Act-On is no longer offered as a standalone product, and the while MailSuite is pretty expensive at $80.00 initial cost and $45.00/year for updates. It's not a subscription though. Once you buy the software you own it up to that point. I assume you can stop and restart paying for upgrades at any point, but I would verify with the devs to be certain.
Also unfortunately the developer of MailHub have been AWOL for a couple of years now, and I think it's likely he died or is otherwise incapacitated.
When I upgrade to Apple Silicon I'll lose the use of MailHub (to my great sorrow), but I'll be able to get by with Mail Act-On and AppleScript + Keyboard Maestro.
-Chris