Zimbra Extension Development

Develop Your Own Zimbra Extensions and Upload to Your Local Zimbra Environment

Nil Seri
2 min readJan 25, 2021
Photo by Lance Asper on Unsplash

For creating a Zimbra extension, your main extension class should implement “ZimbraExtension” class.

In your pom.xml, you should set this class as “Zimbra-Extension-Class”. In “mainClass”, we should set the class we extended for the extension’s purpose.

After “maven clean install”, there will be two jar files under target folder like senoritadev-mailboxlistener.jar and senoritadev-mailboxlistener-jar-with-dependencies.jar

We need “jar with dependencies” version, we can delete the other and rename this as “senoritadev-mailboxlistener.jar”.

The other and the best option is we can create our pom file as below (filter.properties and distribution.xml files should be added to the correct corresponding path):

My filter.properties file is empty and distribution.xml file is as below:

With this config, we run “maven assembly:assembly” and get a single “senoritadev-mailboxlistener.jar” output.

We need 4 zimbra jars for development: zimbraclient.jar, zimbracommon.jar, zimbra-native.jar, zimbrasoap.jar

We can also download these jars from Zimbra itself. Add these in your pom file as below:

If you have an artifactory to upload these jars, you can use them in your pom file as below:

There is an example store manager project using gradle in this link : https://github.com/EMCECS/ecs-zimbra-store-manager. Its jar will be created as “ecs-zimbra-store-manager/build/shadow/ecs-zimbra-store-manager-2.0.0.jar”. You can have a look at the README file for information.

If your extension uses the same maven dependencies as Zimbra, there will be conflicts. To prevent these, be sure the dependencies’ versions are the same as the ones under “/opt/zimbra/lib/jars” and “/opt/zimbra/jetty/common/lib” (under jetty). The dependencies that you use in your extension should be compatible with the ones here.

In Zimbra, extensions are located under “/opt/zimbra/lib/ext” path bulunur. We create a folder for our own extension here and locate our extension jar file there.

For example, I created “senoritadev-mailboxlistener” folder and put “senoritadev-mailboxlistener.jar” under it.

Stop and start Zimbra with these commands:

sudo -u zimbra /opt/zimbra/bin/zmcontrol stop
sudo -u zimbra /opt/zimbra/bin/zmcontrol status
sudo -u zimbra /opt/zimbra/bin/zmcontrol start

We can follow Zimbra logs and check if our extension is being instantiated:

sudo -u zimbra tail -f /var/log/zimbra.log

Related log appears:

2019-12-06 20:42:06,532 INFO [main] [] extensions - Initialized extension senoritadev-mailboxlistener: com.senoritadev.mailboxlistener.extension.MailboxListenerExtension@com.zimbra.cs.extension.ZimbraExtensionClassLoader@1e00bfe2

For extensible classes list in Zimbra, you can visit https://wiki.zimbra.com/wiki/Yutaka-Notes_about_Extensible_Classes_In_ZimbraStore

To see information about how you can write a store manager of your own, you can visit https://wiki.zimbra.com/wiki/StoreManagerSDK

Happy Coding!

--

--

Nil Seri
Nil Seri

Written by Nil Seri

I would love to change the world, but they won’t give me the source code | coding 👩🏻‍💻 | coffee ☕️ | jazz 🎷 | anime 🐲 | books 📚 | drawing 🎨

No responses yet