Python-zarafa update

January 22, 2015 by Suyi  

Hi Community,

 

After introducing python-zarafa earlier this year, we have made many improvements to it (some based on patches from users - thanks!!), added several interesting example scripts showing new capabilities, fixed many issues and also started to write automated tests. As detailed information about individual changes can be found on Jelle van der Waa's blog, we won't repeat this here, and instead we would like to focus on some of the new example scripts (source code can be found on github site).

 

Zarafa-tracer

 

Zarafa-tracer is a small program that can monitor changes in MAPI properties for a given folder, using ICS. For every changed MAPI item, it will compare the old state of the item with the new state, and display in real-time which properties have changed and how. So it can for example be used during Webapp development, to visualize which MAPI properties change when pressing a certain button.

 

Simple mail client

 

Urwap is a simple console-based MAPI mail client in 100 lines, including a "graphical" interface made with Urwid. It can be used to manage one's inbox, which in this case means navigating to a message and either deleting it or replying to it. It's obviously not very useful for daily use, and is indeed more meant as a demonstration of how how easy it can be to use python-zarafa.

Urwap

 

To start the client, it is necessary to authenticate using the new -U and -P standard arguments. For example, I use the following command to connect to my inbox at zarafa.com:

 

$python urwap.py -Uusername -Ppassword -shttps://mail.demobox.tld:237

 

Client-side rules

 

Again as a demonstration of something interesting one can do with python-zarafa, we added a simple example script which shows how to implement client-side rules. It simply hooks into ICS to get updates for a given folder, after which a "rule" can be implemented using anything supported by python-zarafa. In this example, we check the subject of an incoming item and optionally move it to the junk folder.

 

Sending mail

 

While the mail client also does it, we thought it would be useful to separately show how to send mail using python-zarafa. In fact this can now be done using a single line of code, by just creating an item in the outbox folder, specifying subject, recipients and body, and submitting it to the spooler:

 

>>>zarafa.User('user1').outbox.create_item(subject='test', to='[email protected]; [email protected]', body='test').send()

 

We intend to add many more features and example programs over the coming months, but it will probably take a few years to become more or less feature complete. Please keep an eye on Jelle's blog for detailed updates, and let us know if you have an idea for something which would be useful to prioritize.

Feel free to create a post on our development section on our forum

 

Cheers,

Dev Zarafa