[MlMt] Automating message filing (e.g. scripting MailMate or applying rules to multiple Mailboxes at once)

Jolin Warren jolinwarren+mailmate at oakandapple.org
Sat Jan 23 12:22:51 EST 2021

Hello list,

As I’ve mentioned in a previous email, I am moving from Apple Mail to 
MailMate. One aspect of my Mail setup that I’ve not been able to 
replicate is how I deal with messages I file when not on my computer.

I file my messages into various mailboxes using a structure that has 
worked for me over many years. The full mailbox hierarchy with all of 
these messages lives on my computer, via a local IMAP server which 
I’ve added to MailMate as an account named `On My Mac`.^1 On my mail 
hosts, I have a mailbox hierarchy which mirrors a subset of the full 
mailbox hierarchy that is on my Mac. This allows me to file messages 
from my phone or if I ever have to login on another computer via 

So, for instance, I might have the following mailbox hierarchies:

**On My Mac**

     1 Correspondence
     2 Admin
     Deleted Messages

**Mail Account 1 (`email_1 at example.com`)**

     To File
       └1 Correspondence

**Mail Account 2 (`email_2 at example.com`)**

     To File
       └1 Correspondence
       └2 Admin

The mailboxes in `Mail Account 1` & `Mail Account 2` are available to me 
wherever I access my email, but the mailboxes in `On My Mac` are only 
available when I’m on my Mac. So I file messages when I’m on my 
phone, but when I get back to my Mac, I need to (eventually) copy all 
the messages from `Mail Account 1` & `Mail Account 2` to their 
corresponding mailboxes in `On My Mac`.

##Solutions I’ve Investigated
(1) I have written an AppleScript that does this message filing in Apple 
Mail. It simply steps through the mailbox hierarchy on the mail servers, 
starting from a specified root folder, and moves all the messages in 
each mailbox to the corresponding mailbox in `On My Mac`. I’ve had 
look at MailMate’s AppleScript dictionary, and I think it’s too 
rudimentary to do this.

(2) My next thought was that I could set up Rules on the mail server 
mailboxes that would move their contents to the appropriate mailbox in 
the `On My Mac` account. This would require manually customising the 
rules for each mailbox (as opposed to my AppleScript which traverses the 
mail servers’ hierarchies automatically), but at least I can do the 
setup once and then the message filing happens automatically.

However, my Mac is not always on when I’m using email on my phone, so 
I can’t rely on MailMate being open at the point at which messages 
‘arrive’ in the filing mailboxes on the mail host. I thought I could 
get around this by selected all the filing mailboxes on the mail host 
and choosing `Apply Rules`, but it seems that `Apply Rules` is only 
available if you have a single mailbox selected. Note, this wouldn’t 
have been ideal anyway, as it requires several steps to select the 
mailboxes across at least three mail hosts and then trigger the rules. 
Ideally I want to be able to select one menu item or press one key 
combination and have the filing triggered.

So I’m out of ideas. Does anyone have any suggestions as to how I can 
achieve my filing? The task is essentially to automatically move emails 
from the mailboxes underneath a specified root on one or more IMAP 
servers to the correspondingly-named mailboxes on another IMAP server.

Any help with this would be **hugely** appreciated, as it’s the only 
part of my workflow that is really problematic after moving from Mail, 
and the only one where MailMate doesn’t seem to have an alternative 
way of tackling the problem.

Many thanks,

^1 _As a side note, I am aware that this is not the MailMate philosophy 
and the recommended procedure is to store all archive messages on my 
email host(s). For a few reasons I’m not interested in this and 
won’t do it. I’ve read the whole ‘[Archiving to local 
thread on the issue tracker and ended up using the link to [instructions 
on running a local Dovecot IMAP 
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.freron.com/pipermail/mailmate/attachments/20210123/8c16ed2c/attachment.htm>

More information about the mailmate mailing list