[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Re: Client "daemon" for sorting e-mail via IMAP



Hello all,

with embarrassing delay :) I'd like to thank to you again.

Finally I looked at the imapfilter and found out that it was exactly
what I was looking for.  Especially I liked how it's versatile and it
does not make assumptions about where you primarily want to store your
mail---you can make queries based on just about anything, and move
messages between as many accounts/boxes/folders as you can talk via
IMAP with.

And since my rules are pretty simple (all based on List-ID:) and few,
and the volume is not expected to be very high (this list plus couple
of much smaller ones), my config.lua did not get large nor complicated,
so need to patch it up from other scripts did not arise.

(Only thing that could be problem to someone is that IIUC, you
need to store your password in the plain text config.lua; so I
would not use it where security is big priority.)

And here's my config.lua:

    ---------------
    --  Options  --
    ---------------
    
    options.timeout = 120
    options.subscribe = true
    options.info = false
    
    
    ----------------
    --  Accounts  --
    ----------------
    
    am = IMAP {
        server = 'mail.provider.cz',
        username = 'real.name@example.com',
        password = 'foo',
        ssl = 'ssl3',
    }
    
    am1 = IMAP {
        server = 'mail.provider.cz',
        username = 'alois punkt mahdal blob 1 laser ndmail at zxcvb
    rock cz', password = 'bar',
        ssl = 'ssl3',
    }
    
    -----------------
    --  Mailboxes  --
    -----------------
    
    -- Get all the messages in the mailbox.
    am1i = am1.INBOX:select_all()
    
    -- test --
    imft = am1i:contain_field('List-Id', 'imftest')
    imft:move_messages(am1.imftest)
    
    
    -- mailing lists
    
    x = am1i:contain_field('List-Id', 'debian-user.lists.debian.org')
    x:move_messages(am1['debian-user'])
    
    x = am1i:contain_field('List-Id', 'dancer-users.dancer.pm')
    x:move_messages(am1['dancer-users'])
    
    x = am1i:contain_field('List-Id', 'fprint.lists.freedesktop.org')
    x:move_messages(am1['fprint-devel'])
    
    x = am1i:contain_field('List-Id', 'users.httpd.apache.org')
    x:move_messages(am1['users-httpd'])
    
    x = am1i:contain_field('List-Id', 'juser.jabber.org')
    x:move_messages(am1['jabber-user'])
    
    x = am1i:contain_field('List-Id', 'musicbrainz-users.lists.musicbrainz.org')
    x:move_messages(am1['musicbrainz-users']) 

    x = am1i:contain_field('List-Id',
    'security-basics.list-id.securityfocus.com')
    x:move_messages(am1['security-basics']) 

    
    -- SPAM --
    
    x = am1i:contain_field('X-Spam-Flag', 'YES')
    x:move_messages(am1['Junk'])


crontab solves the rest.  Note that `options.info = false` is to turn
off output to avoid cronspam (e.g. how many messages were moved).


Thanks,
aL.


Reply to: