[imapfilter-devel] Generic rules?

Joe MacDonald joe at deserted.net
Thu Sep 25 16:32:50 EEST 2014


[[imapfilter-devel] Generic rules?] On 14.09.25 (Thu 02:18) Andrei POPESCU wrote:

> Hi,
> 
> I'm transitioning from a getmail + maildrop setup to using IMAP 
> directly, but I have to use imapfilter due to the limited filtering 
> capabilities available in GMX.
> 
> Since I'm subscribed to many lists on the same server and I might 
> subscribe/unsubscribe some lists from time to time with maildrop I use 
> rules like this:
> 
> 
>     # These are the lists.debian.org lists
>     if (/^List-Id:.*<debian-(.*)\.lists.debian.org>/)
>         to Maildir/.debian.$MATCH1/
> 
> 
> but I can't figure out how to do this with imapfilter (if possible).

It is possible, to a degree.  I have something very much like this in my
config.lua:

   msgs = dn.INBOX:contain_field('List-id', 'users.list.opensaf.org') +
          dn.INBOX:contain_field('List-id', 'bod.list.opensaf.org') +
          dn.INBOX:contain_field('List-id', 'openais.lists.linux-foundation.org'))
   [...]
   dn.INBOX:move_messages(dn['SAF'], msgs)

However, it's highly dependent on your IMAP server whether this will get
you matches or not.  My experience is that all versions of Exchange
since 2003 (the earliest I've used this on) you'll get close to 75%
success rate.  Other servers do better, one I used, (dovecot, maybe? I
don't recall) gave me 100% success for the time I was using it.
Basically, though, this makes filtering like this nearly useless with
Exchange since it will miss sometimes and you still get stuff landing in
your inbox that should be filtered away.  Better than nothing, perhaps,
but I didn't think so.

Note, though, that this isn't an imapfilter problem, it's the server's
implementation of IMAP.  imapfilter has at least one issue open on it:

https://github.com/lefcha/imapfilter/issues/45

but you can have a look at this thread:

   http://lua-users.org/lists/lua-l/2012-08/msg00244.html

to get a more detailed explanation of the symptoms and the root cause.

In my experience, your best bet is to filter based on subject tags (if
your list happens to include them) or to/cc.  Those are the fields that
the IMAP spec says you must be able to search on.

-J.



> 
> Would appreciate any guidance. I'm using imapfilter 2.5.2 from Raspbian 
> (Debian 7 wheezy for the Raspberry Pi).
> 
> Thanks,
> Andrei
-- 
-Joe MacDonald.
:wq
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 198 bytes
Desc: Digital signature
URL: <http://lists.hellug.gr/pipermail/imapfilter-devel/attachments/20140925/f05f5d48/attachment.sig>


More information about the Imapfilter-devel mailing list