IMAP Filter


EQ Forum Admin
Staff member

imapfilter is a tool for moving messages from one IMAP mailbox to another based on a set of regular expressions. The "rules" file defines the actions to be taken:

Header-field<tab>String<tab>source mbx<tab>destination mbx

Header-fields are the keywords in an SMTP message header, for example From, Subject, To, cc, etc. A destination mailbox may a local one or on a remote IMAP server. Connection information for remote servers is provided by the "RemoteServer" keyword in the rules file, eg RemoteServer: myhost/myuser/mypassword. A remote mailbox is defined in the rules as remotehost:mbx_name.

./ -S host/user/password -r <rules file> [-d] [-I]

Optional arguments:
-d debug
-I show IMAP protocol exchanges
Notes on Date comparison operations. imapfilter permits you to filter on dates which are earlier, later, or the same as a specified date. The date in the rules must be in RFC822 Mail date format (eg, 12 Nov 2009 12:45:10 +0500) or expressed as an offset from the current date (eg +30 meaning within the past 30 days). Some examples:

Date ">22 Dec 2008 15:00:00 +0000" INBOX MOVED
Date "<15 Jan 2009 00:00:00 +0500" INBOX MOVED
Date "=25 Dec 2009 08:00:00 +0500" INBOX MOVED
Date ">+60" INBOX MOVED
Date "*2009*" DATE INBOX

If you have a question about using this script please reply.

If you would like to download the script please see How to get the IMAP Tools.