Results 1 to 5 of 5

Thread: Want to hook mail message delete event.

  1. #1
    stalker is offline Special Member
    Join Date
    Mar 2011
    Posts
    131
    Rep Power
    4

    Default Want to hook mail message delete event.

    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.

  2. #2
    vmahajan is offline Zimbra Employee
    Join Date
    Jan 2010
    Posts
    138
    Rep Power
    5

    Default

    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.

  3. #3
    stalker is offline Special Member
    Join Date
    Mar 2011
    Posts
    131
    Rep Power
    4

    Default

    Quote Originally Posted by vmahajan View Post
    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.
    Thank you mate for the link. I will look at it and let you know.

  4. #4
    stalker is offline Special Member
    Join Date
    Mar 2011
    Posts
    131
    Rep Power
    4

    Default

    Quote Originally Posted by vmahajan View Post
    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 couldn't find the source code of the interface com.zimbra.cs.mailbox.MailboxListener. Please connect me to the source code of the com.zimbra.cs.mailbox package.

    Thanks.

  5. #5
    stalker is offline Special Member
    Join Date
    Mar 2011
    Posts
    131
    Rep Power
    4

    Default

    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.

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Similar Threads

  1. Emails bouncing with "Error Text: 401,'null'"
    By sholden in forum Zimbra Connector for Outlook
    Replies: 27
    Last Post: 08-20-2008, 04:59 PM
  2. Problem with Postfix and MTA
    By ZMilton in forum Administrators
    Replies: 16
    Last Post: 04-16-2008, 06:47 AM
  3. My Zimbra server down ... please help :)
    By frankb in forum Administrators
    Replies: 2
    Last Post: 12-12-2007, 11:29 AM
  4. Replies: 3
    Last Post: 07-19-2007, 02:00 AM
  5. Sending mail to external addresses
    By dmg in forum Installation
    Replies: 1
    Last Post: 02-21-2007, 01:16 PM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •