Sorting emails into monthly folders

Tomasz Żok tomasz.zok at gmail.com
Tue Jan 19 10:00:21 GMT 2016


Hi nanooq,

On 2016-01-18 at 18:21, offlineimap at nanooq.org wrote:
> how do I sort emails into monthly folders?

This seems to be a question outside of OfflineIMAP scope, but briefly
saying, there are two ways to go. 

If you want it done manually from time to time, it is a responsibility
of your e-mail client to let you select messages older than 6 months. In
mutt, you can press "T" to tag messages and write criterion like:
    ~r -01/07/15
This will select all e-mails you have ever received up to 1st of July
2015. Then you can press "s" and save them in any folder as you please.
OfflineIMAP will create that folder remotely upon next synchronization.

If you want it to happen automatically for new e-mail (because for
messages already received, you will have to do the manual sorting
anyway), I believe it depends on which IMAP server you work with and if
it allows such use case. For example, if the IMAP server has support for
Sieve, you can write some kind of script to work the way you want it.
Below is an example from Sieve documentation:
(https://tools.ietf.org/html/rfc5260)
     require ["date", "relational", "fileinto"];
     if anyof(date :is "received" "weekday" "0",
              date :is "received" "weekday" "6")
     { fileinto "weekend"; }

That's not exactly what you asked for, but as you can see, Sieve
extension described in RFC 5260 allows you to use dates of e-mails in
the rules. I haven't used it myself, but I think it's possible to file
messages into 2016-01, 2016-02, and so on automatically.


I personally prefer the Inbox Zero way where I put every e-mail already
handled into a special archive folder and keep Inbox empty. If the
archive folder ever gets too big, I sort it the manual way but in
a yearly fashion (archive-2011, archive-2012, ...). Maybe it depends on
the volume of e-mail you get, but for me a separate folder for every
month would be more of a problem than solution :).

Hope it answers your questions and helps you, regards,
Tomasz




More information about the OfflineIMAP-project mailing list