I want to log some information when user delete, receive, send and move an email in zimbra. For that I've tried to write a zimbra extension. See following code. But I couldn't find a way to differentiate the events. The extension is getting call every time but no way to say that whether it is delete or move or send email event.

Can anybody shed some more light?

package my.listener;

import com.zimbra.common.service.ServiceException;
import com.zimbra.cs.extension.ExtensionException;
import com.zimbra.cs.extension.ZimbraExtension;
import com.zimbra.cs.mailbox.MailItem;
import com.zimbra.cs.mailbox.MailboxListener;
import com.zimbra.cs.mailbox.OperationContext;
import com.zimbra.cs.session.PendingModifications;

public class MyDeleteMailListener extends MailboxListener implements ZimbraExtension{

	public void destroy() {
		System.out.println("MyDeleteMailListener - In Destroy");

	public String getName() {
		return "MyDeleteMailListener";

	public void init() throws ExtensionException, ServiceException {
		System.out.println("MyDeleteMailListener - In Init and registering");

	public void handleMailboxChange(String arg0, PendingModifications arg1,
			OperationContext arg2, int arg3) {
		System.out.println("MyDeleteMailListener - In MailboxChange for account id: " + arg0);
		System.out.println("MyDeleteMailListener - In MailboxChange : " + arg1.changedTypes);

	public int registerForItemTypes() {
		System.out.println("MyDeleteMailListener - In RegisterForItemTypes " + MailItem.typeToBitmask(MailItem.TYPE_CONVERSATION) + " and " + MailItem.typeToBitmask(MailItem.TYPE_MESSAGE));
		return MailItem.typeToBitmask(MailItem.TYPE_CONVERSATION) | MailItem.typeToBitmask(MailItem.TYPE_MESSAGE);
Thank You!