--------------------- -- General Options -- --------------------- -- Otherwise the timeout is infinite options.timeout = 120 -- Newly created mailboxes are automatically subscribed options.subscribe = true ---------------------- -- Account Settings -- ---------------------- myaccount = IMAP { server = 'imap.myserver.org', username = 'myuser', password = 'mypassword', ssl = 'ssl2' } ----------- -- Rules -- ----------- function SortMail() -- Forum -- Move messages from "no_reply@myforum.org" to the maildir -- folder "MyForum". messages = myaccount.INBOX:match_from('no_reply@myforum.org') myaccount.INBOX:move_messages(myaccount['MyForum'], messages) -- Mailings -- Move messages that contain "mailings.org" in the sender and -- "Mailing" in the subject to the maildir folder "Mailings". -- "*" is the "AND" operator messages = myaccount.INBOX:contain_from('mailings.org') * myaccount.INBOX:contain_subject('Mailing') myaccount.INBOX:move_messages(myaccount['Mailings'], messages) -- Administration -- Move messages that contain "root" or "administrator" in the -- sender to the maildir subfolder "Users/Root". -- "+" is the "OR" operator messages = myaccount.INBOX:contain_from('root') + myaccount.INBOX:contain_from('administrator') myaccount.INBOX:move_messages(myaccount['Users.Root'], messages) end -- Daemonize imapfilter and run the rules in function "SortMail" every -- 60 seconds. become_daemon(60, SortMail)