Friday, June 26, 2009

I don't want all these mails on my iPhone!

A week ago i was writing on this blog about about the iPhone 3.0 OS update and as a disadvantage i had that there is no mail filters yet.

I really hate it when my laptop is not connected to the imap server (in order to filter all my mails) and i get all these SPAM and mailing list mails on my iPhone. It makes it totally useless.

The first thought i had was to use procmail which seem to be powerful with one "show-stopper" for me. It requires to have access to your mailbox server in order to upload your procmail configuration.

Then i thought to search for a simple client that will connect to IMAP, filter my mails and then logout. The client that i found is imapfilter which is actually developed a Greek guy!

Its operation does EXACTLY what i want. You feed it with an easy to read configuration (LUA):

---------------
-- Options --
---------------

options.timeout = 120
options.subscribe = true


----------------
-- Accounts --
----------------

-- Connects to "imap1.mail.server", as user "user1" with "secret1" as password.
account1 = {
server = 'imap1.mail.server',
username = 'user1',
password = 'secret1',
ssl = 'ssl3',
}

---------------
-- Filters --
---------------

spam = {
'new',
'header "X-DSPAM-Result" "Spam"',
}


----------------
-- Commands --
----------------

-- Get status (messages, recent, unseen) of the mailbox.
-- check(account1, 'INBOX')

-- Move messages between mailboxes at the same account.
results = match(account1, 'INBOX', spam)
move(account1, 'INBOX', account1, 'SPAM', results)

I just setup a cronjob for this and works perfect!

No comments:

Post a Comment