my application is a java based web application
I want to write some function to integrate it with zimbra

I spend a whole day to find some infomation, but now I still don't know how to do this. Perhaps, this is because my English is not good enough

The first thing I want to do is when zimbra received a email(in any mailbox), I can detect it immediately, and analyze the mail content. If the content is fixed format, my application will do something.

Please show me the way.
web service? JAR files? any other things?
give me some links please...