January 29, 2005

python-managesieve for Python 2.3, Cyrus, and timsieved

In the process of migrating a mail server, I needed to turn a bunch of .qmail scripts into some Sieve scripts. The system being migrated from was Qmail and vpopmail, using qmailadmin to allow users to set up vacation messages and mail forwarding. On the new server, I’m using Cyrus, and users set up forwarding and vacation messages from SquirrelMail using avelsieve.

I wrote a Python script to do the PHP serialization and Base64+URL encoding avelsieve does (it doesn’t parse Sieve, instead it includes a serialized PHP array in comments that explains the rule). So I could generate scripts, but I needed a way to get them into Cyrus. I found python-managesieve. Unfortunately, I ran into three problems with it:

  • With Python 2.3’s imaplib module in that python-managesieve accessed some internal members (_log, _mesg) that were moved from module level into class level.
  • My installation of Cyrus/timsieved only supports PLAIN authentication, but python-managesieve only supports LOGIN.
  • When timsieved advertises STARTTLS, python-managesieve seems to choke.

So I fixed up these problems and rolled the fixes into an RPM based on the RPM generated by distutils. I tested this on FC3, Python 2.3.4.

darkness’ patched python-managesieve

Comments (2)

  1. March 11, 2005
    Anonymous said...

    hello, can you share that python php-serialization stuff?
    we are translating our web application from php to python right now and need some compability with older stuff. thanks.

  2. March 11, 2005
    Ivan Tikhonov said...

    oops. forgot my coordinates

Leave a Reply