Hello Guys,
I want to do some task when the user delete a mail message from zimbra. Can anybody guide me how can I do that?
Thanks in advanced.
Dhaval.
Hello Guys,
I want to do some task when the user delete a mail message from zimbra. Can anybody guide me how can I do that?
Thanks in advanced.
Dhaval.
You can write your own zimbra server extension (» Zimbra :: Blog) which listens for deletion of mail message items. The extension would need to implement com.zimbra.cs.mailbox.MailboxListener interface.
I've created following java class and make a jar file of it. Added the line in menifest file and then deployed it under <zimbra install dir>/lib/ext/<my extension>/my.jar
Now everything is working fine. I am getting events on delete mail message. But how can I fetch the path of the blob file which attached with the email?
Code:package my.listener; 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.common.localconfig.Logging; import com.zimbra.common.service.ServiceException; public class MyDeleteMailListener extends MailboxListener implements ZimbraExtension{ @Override public void handleMailboxChange(String accountId, int changedTypes, OperationContext octxt) { System.out.println("MyDeleteMailListener - accountid " + accountId + " changeTypes " + changedTypes + " Operationcontext " + octxt); Logging.warn("MyDeleteMailListener - accountid " + accountId + " changeTypes " + changedTypes + " Operationcontext " + octxt); } @Override public int registerForItemTypes() { Logging.warn("MyDeleteMailListener - Registering type"); return MailItem.TYPE_MESSAGE; } @Override public String getName() { Logging.warn("MyDeleteMailListener - getName"); return "Stalker Extension"; } @Override public void init() throws ServiceException { Logging.warn("MyDeleteMailListener - in init"); register(this); } @Override public void destroy() { Logging.warn("MyDeleteMailListener - in desstroy"); } }
Last edited by stalker; 05-03-2011 at 09:52 PM.
There are currently 1 users browsing this thread. (0 members and 1 guests)