On Tue, Jan 22, 2013 at 06:45:06PM +0100, Alois Mahdal wrote:
> Hello everyone!
> 
> I wonder if there already is a solution for this:
> 
> I have several mailboxes in various places that I access using
> several clients (e.g. other from my laptop, other from my Android
> and other from a public place).
> 
> Some of boxes (e.g. the one I use for various mailing lists including
> debian-user) are quite high-traffic and obviously in need of some
> filtering, be it based on origin or the spam score.
> 
> Since I'm using various clients, filtering using rules in MUA is not
> practical.  I would prefer to have all this logic in a single place,
> (namely my personal VPS box), where for example a script would exist
> just for purpose of regularly checking new mail and moving the
> new messages to given folders based on pre-defined rules.
> 
> I think that this could be nice universal solution for any number of
> mailboxes (as long as they support IMAP), completely avoiding the
> question of when I actually use which MUA to read/write stuff.
> 
> Any ideas how to do this easily? (Of course, the mentioned VPS is Debian
> Wheezy.)  Or, is there a ready solution that could be used right away?

Hi Alois,

Fetchmail for getting messages and procmail for filtering
them is probably the most widely used solution.
Procmail is powerful, however the syntax for recipes 
is not exactly user-friendly.

I can suggest something possibly simpler,
assuming you're comfortable dealing with perl, 

I use a script based on Net::IMAP::Client and Email::Filter,
the latter written specifically to substitute for procmail. 

Here's what the rules look like. You can examine anything in
the head or body. Not beautiful, but flexible
and sufficiently comprehensible.

        return "python-app"
                if $mail->to =~ /python-apps-team/i or
                        $mail->cc =~ /python-apps-team/i;

        return "lau"
                if $mail->to =~ /linux-audio-user/i 
                or $mail->cc =~ /linux-audio-user/i ;

        # Some list managers hack the Reply-To field
        # to redirect all replies to the list.
        # 
        # Reset this field so MUA reply goes to 
        # original poster
        
        $mail->simple->header_set("Reply-To",""), return "feldy"
                if ($mail->to =~ /feldyforum/i ) ;


I'll clean up and post the script if anyone is interested.

Joel
 
> -- 
> Alois Mahdal
> 
-- 
Joel Roth


-- 
To UNSUBSCRIBE, email to debian-user-requ...@lists.debian.org 
with a subject of "unsubscribe". Trouble? Contact listmas...@lists.debian.org
Archive: http://lists.debian.org/20130122185637.GA24200@sprite

Reply via email to