:: Steve.org.uk
[ Home | About Steve | Free Software | Images ]



Free Software

sift : The IMAP utility

sift is a simple client-side, utility for manipulating messages stored upon a remote IMAP server.

Using it you can create simple rule-files which allow operations to be conducted against the remote store.

A typical use would be to:

  • Connect to an IMAP server.
  • Open a remote folder.
  • Find messages which are new and contain a given string in their subjects.
  • Mark them as read, and execute a program.

This basic usage is demonstrated in the simple rule-file sample distributed with the code.

top
The Rule File Primitives

There are two types of rules which sift understands: Those that select messages and those that operate upon them.

When reading these rules you must keep in mind how sift works - at all times there is a list of messages which are regarded as "selected". The selection rules reduce that list of selected messages by some criterea, and the operating rules run against them.

The selecting rules:

  • folder:xxx
    • Open folder xxx, and select all messages. You should replace spaces, if any, with '#'. For example folder:[Google#Mail]/Spam
  • subject:foo
    • Reduce the set of selected messages to those containing the given string in the subject.
  • from:x@y.com
    • Reduce the set of selected messages to those from the given address.
  • status:[new|old]
    • Reduce the set of selected messages to those which are either new, or old.

The operating rules are:

  • delete
    • Delete all currently selected messages.
  • move:bar
    • Move all selected messages to the folder bar.
  • mark:[read|unread]
    • Change the new/old flag of the selected messages.
  • exec:/path/to/script
    • Execute the given script once for each message. The message will be passed to the command as STDIN.
  • execonce:/path/to/script
    • Similar to exec:, but the given script once regardless of the number of selected messages. (There must be at least one message selected; no message bodies are passed to the script.)
  • dump
    • A diagnostic rule which will dump some details of each selected message to STDOUT - such as sender, recipient, and subject.

More details are included in the supplied README file.

top
Download Sift

You may download the current stable release from the following links:

There is also a Debian package available for the Stable (etch) release, you may find that in my apt-get repository.

If you'd like to try something more cutting edge please see the sift mercurial repository.

top
Installation

To use the software you'll need the Net::IMAP::Simple::SSL module. A Debian GNU/Linux users may install this by running:

apt-get install libnet-imap-simple-ssl-perl

Download, unpack, and run "make install".

top