2011-01-09

Pimping MobileMe #1: Expiration dates on folders

Well, MobileMe does not yet support the expiration of mails in folders. Especially for mailing lists, I want this feature. After let's say 90 days the mails should be automatically deleted. I do not need to store mailing list contents for longer. So I took the nice tool imapfilter and wrote a config file that expires old mails from a selection of folders. I installed a cronjob on my web server that now automatically calls imapfilter every night. The config file (~/.imapfilter/config.lua) looks like this:


Myaccount = IMAP {
   server = 'mail.me.com',
   username = 'your.name@me.com',
   password = 'yourpassword',
   ssl = 'tls1'
}


folders = {'folder1', 'folder2', 'folder3'}


for k,folder in pairs(folders) do
   foldername = 'Mailinglists/' .. folder
   results = myaccount[foldername]:is_older(90)
   myaccount[foldername]:delete_messages(results)
end

My mailing lists are hosted under a sub-folder called "Mailinglists", as you can notice in the config file above. You can tweak this to your liking. It might also be useful to set different expiration dates. It's easy to augment the lua script to do so.

1 comment:

  1. Thanks. That sounds just like the tweak I need.

    ReplyDelete