[Discuss] Scripting IMAP for large numbers of messages?
Dan Ritter
dsr at randomstring.org
Thu Jan 7 10:07:07 EST 2021
Matthew Gillen wrote:
> On 1/7/2021 9:32 AM, Daniel Barrett wrote:
> >
> > Has anyone done any scripting to manipulate email on a remote IMAP
> > server? I'd like to select about 50,000 emails from an Inbox of
> > ~80,000 (say, all emails from 2020) and move them to a different
> > folder on the same IMAP server. I'm wondering if fetchmail or similar
> > tools can do this (but am open to other suggestions).
> >
> > FYI, I've tried this operation in several GUI IMAP clients but they
> > all either (1) fail for large numbers of messages, or (2) have such a
> > cumbersome selection process (for "all emails from 2020") that it
> > would take an hour to highlight all the emails.
> >
> > Thanks for any tips, or even just a pointer to the best tool(s) for
> > the job.
>
> I'd be surprised if mutt didn't do the trick for you. If you're a vi
> person, you'll like mutt.
>
> http://mutt.org/
>
> Specific examples of tagging messages:
> http://therandymon.com/woodnotes/mutt/node19.html
>
mutt is my everyday client, but I also strongly recommend it for
situations where you need to deal with more than 10,000
messages. I have used it on folders with more than 1MM messages.
tag all messages from 2020:
t~d20200101-20201231
mnemonic: tag with date
move tagged messages to new folder and mark as deleted in
current folder:
;s
mnemonic: save
clear deleted messages from current folder:
$
mnemonic: sync
-dsr-
More information about the Discuss
mailing list