SIEVE for Squirrelmail 0.6 (beta)
Introduction
This is a Squirrelmail plugin for creating SIEVE scripts on a Cyrus
IMAP server that runs timsieved (Tim's SIEVE daemon).
SIEVE is a mail filtering language, intended for server-side filtering of
emails. See RFC 3028 and Cyrusoft's page about SIEVE for more
details.
Version 0.6 was released on 29/5/2002. Read further down for the
Changelog.
IMPORTANT: A change in the creation and handling of header-type
filtering rules will mean that the existing rules that your users have probably
created in the pre-0.6 era will not be displayed anymore. This might
not be catastrophic, but it would be better for the users to recreate the
scripts anyway, to avoid any confusion.
About this implementation
The web interface provides a wizard-like interface that, in the end,
creates part of a SIEVE script, a 'rule' as I call it. It then assembles all
the rules to form a SIEVE script.
It puts the PHP variable (associative array $sess), serialized &
base64-encoded, on a comment on the SIEVE script, which I then get back when I
want to get my rules back and show them to Joe User. No, I didn't have the time
nor the motivation to write a complete SIEVE parser.
Thus, the only thing that is supported is a script called
"phpscript" on the Cyrus server. Multiple scripts are not supported.
I've tried to make it sane enough that it won't break a lot. Some more testing
is needed - hence the alpha state.
I haven't followed the Squirrelmail coding style, sorry. I use tabs. If
someone wants to adapt this to SM-style, feel free to do so.
table.php is the core script that shows a table of the current rules.
addrule.php displays a wizard-like interface for adding a new rule. It asks for
the type of rule, when it triggers, and what to do when it triggers.
Status
This is beta software. It has been out for a while and is known to work
pretty well. You'll have to check for yourselves if it is for a production
environment. Features (and bugs) are added every other day. Insert standard
GPL_Disclaimer(); here.
Features
This plugin provides:
- Simple HTML, no Javascript.
- Match messages based on email headers, size, or apply to all messages.
- Configurable number of header matches.
- Support of keeping a message, move to an existing or new folder, email redirection.
- Vacation (a la SIEVE).
- Runs through all the rules, but supports a "stop" command when a rule matches.
- Change the order of rules - or delete them altogether.
- Make a textual description of the rule.
- Localizable. Translations in German and Russian already exist.
..but does not provide:
Features with Seniority (Bugs)
- Localization seems to not work properly some times in the page header.
- Error handling when creating a folder with invalid characters etc.
- The layout on some pages from avelsieve does not look good in konqueror
(kde3.0.1) and Netscape 6, both on linux.
(Torsten Westermann)
- Remove the custom stylesheet and use the user's CSS in addrule.php.
- In konqueror the button Clear this Form is a text-field.
(Torsten Westermann)
Requirements
License
This program is free software; you can redistribute it and/or
modify it under the terms of the GNU General Public License as
published by the Free Software Foundation;
either version 2 of the License, or (at your option) any later version.
This program is distributed in the hope that it will be useful, but
WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public
License for more details.
Download
Installation and Configuration
Very easy. Just untar it under Squirrelmail's plugin directory, and use
configure/conf.pl or ./configure or vi config/config.php to add the plugin as
usual.
Afterwards, check avelsieve/config.php and change the default values in case
they do not satisfy you. This file is self documented with comments.
Please note that if you want to use the existing translations, at the moment
you have to copy the files
avelsieve/locale/lang/LC_MESSAGES/avelsieve.* to your
$sm_root/locale/lang/LC_MESSAGES/. This may be fixed in the future.
History
0.6 (29/5/2002)
- New feature: When adding a new header rule, at step 2 a user can define
many if statements, which will all be ANDed or ORed. The GUI was
sorted out as well. Rows of statements can be added or removed dynamically with
submit buttons. The maximum number of statements inside the rule, as well as
the starting number of statements and the headers to display in the listbox,
are now all administrator-definable, in config.php.
- Added i18n hooks and support for gettext.
- Added german translation by
Torsten Westermann.
- Added russian translation by
Vadim Kozlov.
- Added Features, bugs sections in documentation.
0.5 (19/4/2002)
- Fixed a bug that triggered when a user decided to click somewhere else
(e.g. on a folder in the folder list frame) when adding a rule, and then wanted
to come back and add a rule.
- Fixed another bug having to do with strange chdir()s (again). Strange that
these don't occur in my PHP installation. Thanks to Martin (no further info ;-)).
- Added GNOME themes for the icons.
- Changed status to beta. :)
0.4 (4/4/2002)
- Fixed the hook function name. Thanks to Nick
Sayer for reporting this.
- Fixed (hopefully) a bug that appeared when user deleted all the rules.
Apparently, a script with just a require line was created. Again, thanks to
Nick Sayer.
- Fixed a small chdir problem in table.php. Thanks to Stephane Bonnell and Claus
Nielsen.
- Changed the overall behaviour: no more if { ... } elseif {... } else {
...}. Now, every rule is in its own if block. Also added the option to stop
processing any rules. This means that the default rule stuff is now obsolete.
So, now every rule is checked against, until the end of the script or
until a stop statement is found. (David
Mendenhall)
- Instead of a default rule (aka else statement), one can select "All
Messages" in the rule type (step 1), thus defining an "if
(true)" rule that will apply everywhere. (David
Mendenhall)
- Added vacation functionality. (David
Mendenhall)
- Added the options "does not contain" and "is not",
along with their positive counterparts, in the header match if clause. (David Mendenhall)
- Eye candy: Added images for the move up / move down / delete buttons. It is
even themable (from an administrator's point of view ANW).
- Add the option to create a new folder "on the fly", when adding a
new rule (in step 3). The error handling, though, is very poor. Therefore,
this feature is for testing only - and disabled by default in config.php.
- The text at some places is nicer and more user-friendly. (David Mendenhall)
- Prevent wrapping on the options column in table.php.
- Added a STOP icon in step 3 of addrule.php. ;)
- Removed obsolete files htmlprint.inc and htmlfunc2.inc. Somehow they
survived. :-)
- Added gray_plain theme. (David
Mendenhall)
0.3
- Introduced an option to be conservative on the connections to SIEVE daemon.
Uses cached variables in the PHP session, but requires the user to
logout after she's done with her changes. This feature is still under
development.
- Move Up / Move Down functionality in the rules table.
- Added config.php for setting options.
- Fixed a bug that triggered when one pressed Cancel while adding a rule,
and then tried to add another rule.
- Some code cleanup in table.php. Debug messages that showed up are now
hidden. Made the function upload_script().
- The integration with SM is just a little better; the theme colors are
now taken into account, in both table.php and addrule.php. :-)
0.2
- Added "default rule" functionality, that is, the much
anticipated "else" clause. :-) If not used, the default remains
SIEVE's implicit keep, i.e. fileinto INBOX, accordingly to
the SIEVE RFC.
- Miscellaneous code cleanup -- it's still pretty much a mess though.
- Added it to the official Squirrelmail plugins
site.
0.1
- First public release.
- Modified it to work as a squirrelmail plugin.
Pre 0.1
- It started as a standalone script, built on top of Dan Ellis' test
scripts that come with sieve-php.lib.
TODO
- (Edunet-avelsieve): In vacation, get the address field from LDAP.
- (0.7, 0.8) Caching (aka "conservative" mode) has been introduced
in 0.3 to reduce the binds to Cyrus timsieved. Test that some more and make it
even better.
- (0.7) Error handling when creating a new folder in step #3 really sucks.
Fix it.
- (0.8) Support "ready-made rules", like: All messages sent
only to me, Place emails alphabetically in folders A-M and N-Z
etc. (need ideas!)
- (0.8, 0.9) In a message with List-ID: header, provide the option to
automatically add a filtering rule for mailing list emails.
- (0.9?) Synchronization between folders mentioned in fileinto rules and
actual folders that exist in the Cyrus tree.
- (1.0+) Respond with mime-encoded files. Support the :mime parameter.
(info-cyrus
relevant mail)
- (0.9+) Support Sieve
Extension: Relational Tests
Author
Alexandros Vellis,
Network Operations Centre, EDUnet, University
of Athens
(Personal home page).
Translators:
- Russian: Vadim Kozlov (vad at tomsknet ru)
- German: Torsten Westermann (westermann at linux-provider net)
Thanks, Credits
- David Mendenhall (david at digitalfountain com), for a lot
of code contributions and good ideas (just check the changelog for 0.4). Many
thanks!
- Dan Ellis (danellis at rushmore dot com), for developing the sieve-php class, since this plugin
was originally based on his class and test scripts.
- Our translators!
- Nikos Voutsinas (nvoutsin at noc uoa gr), for all the ideas, suggestions
and constructive criticism. And for patching Cyrus imapd to work better
with Squirrelmail.
- Maria Nasiakou for bringing us ice cream.