Filtering Email

Tomasz Żok tomasz.zok at gmail.com
Fri Oct 24 09:09:29 BST 2014


On 2014-10-23 at 12:13, Romain Pelisse wrote:
> Before using offline-imap (a long time ago now), I had some fetchmail
> scripts to automatically sort email / tag as read. I'm starting to again
> have the need for such feature, and I was wondering what is the
> "recommended" way to do it offline-imap (maybe still using fetchmail ?
> Maybe just using some offline-imap feature I overlooked ? Or maybe with an
> other tool ?)

The best way would be to filter server-side. Then you synchronize with
OfflineIMAP once and everything is sorted out (because the filtering itself was
already done on the server). If you are using Gmail, it's the best to work out
the filtering rules in the webmail. If you are using some other IMAP server,
you could ask the administrator if there is SIEVE support or at least procmail
installed. Both are tools suited for e-mail matching and performing actions on
them (moving to folders, changing flags, etc.)

If you cannot filter server-side, there is a tool called imapfilter. You
configure it on your client machine and it just connects to the IMAP server and
shuffles e-mails according to your rules. For some time I used it as
a "presynchook" in OfflineIMAP and it worked fine. But there is a big
disadvantage of imapfilter. It needs an additional connection to the IMAP
before every sync, which takes time if you have lots of e-mail and/or complex
rules and/or slow Internet connection.

Finally you can automatically manage e-mails after OfflineIMAP synchronizes
them (a "postsynchook"). I cannot name any specific tool to do this, but surely
it is possible. The disadvantage here is that when you synchronize and sort
e-mails, they will be seen as such only on your local computer until you
synchronize again. Maybe in your configuration that's not an issue, but still
worth to mention.


To sum up, in my opinion one should use server-side filtering whenever
possible. And that would free you from making any changes in the OfflineIMAP
config :)

All the best,
Tomasz




More information about the OfflineIMAP-project mailing list