User Tools

Site Tools



Getting tired of managing tons of emails/email addresses ? I am too. So I decided to automatically sort this mega mess. I will use imapfilter as it looks easy to use/configure


install imapfilter from the repositories of your distribution.


Create the imapfilter folder and the LUA config file:

mkdir -p ~/.imapfilter
vim ~/.imapfilter/config.lua

Edit it:

-- One of the work mailservers is slow.
-- -- The time in seconds for the program to wait for a mail server's response (default 60)
-- options.timeout = 120
-- According to the IMAP specification, when trying to write a message to a non-existent mailbox, the server must send a hint to the client, whether it should create the mailbox and try again or not. However some IMAP servers don't follow the specification and don't send the correct response code to the client. By enabling this option the client tries to create the mailbox, despite of the server's response. 
options.create = true
-- By enabling this option new mailboxes that were automatically created, get also subscribed; they are set active in order for IMAP clients to recognize them
options.subscribe = true
-- Normally, messages are marked for deletion and are actually deleted when the mailbox is closed. When this option is enabled, messages are expunged immediately after being marked deleted.
-- options.expunge = true
gmail1 = IMAP {
    server = "",
    username = "",
    password = "M3g@P@ss",
    ssl = "tls1"
-- example filters
-- move calendar noification from my wife when read to a folder Events
print('moving Events')
events = gmail1.INBOX:contain_subject('New Event') + gmail1.INBOX:contain_subject('Updated Invitation:') + gmail1.INBOX:contain_subject('Canceled Event') * gmail1.INBOX:is_seen() *
       gmail1.INBOX:contain_from('') *
events: mark_seen()
-- google + messages ( useless, are on G+ && on the phone…)
print('Cleaning google+')
googleplus = gmail1.INBOX: contain_from('') *

Once set, you can simply run:


You can of course create more complex filters


mail/filter.txt · Last modified: 2017/04/22 20:58 by warnaud