Results 1 to 3 of 3

Thread: Java Spring ImapIdleChannelAdapter and AUTHENTICATE PLAIN

  1. #1
    RizziCR is offline Member
    Join Date
    Aug 2011
    Posts
    10
    Rep Power
    4

    Default Java Spring ImapIdleChannelAdapter and AUTHENTICATE PLAIN

    Hi.

    I try to build an Java Spring App with ImapIdleChannelAdapter to receive all new incoming messages in multiple Mailboxes.

    I get single Usermailbox with the username/password for this mailbox to work and now i try to get access to this and the other mailboxes on the zimbra server with the admin username/password, cause i don't know the other username/password combines.

    My current code:
    Code:
    ImapIdleChannelAdapter channelAdapter = null;
    ImapMailReceiver mailReceiver = null;
    Properties props = null;
    try {
    	props = new Properties();
    	props.setProperty("mail.imap.host", "zimbra.server.tst");
    	props.setProperty("mail.imap.port", "993");
     	props.setProperty("mail.imap.auth.login.disable", "true");
    	props.setProperty("mail.imap.auth", "true");
    	props.setProperty("mail.imap.ssl.enable", "true");
    	props.setProperty("mail.store.protocol", "imaps");
    	props.setProperty("mail.debug", "true");
    	props.setProperty("mail.imap.socketFactory.class", "javax.net.ssl.SSLSocketFactory");
    	props.setProperty("mail.imap.socketFactory.fallback", "false");
    	props.setProperty("mail.imap.connectionpoolsize", "5");
    
    	mailReceiver = new ImapMailReceiver("imaps://user1%40server.tst@zimbra.server.tst:993/INBOX");
    	mailReceiver.setJavaMailProperties(props);
    	mailReceiver.setJavaMailAuthenticator(new Authenticator() {
    		protected PasswordAuthentication getPasswordAuthentication() {
    			return new PasswordAuthentication("admin", "adminpassword");
    		}
    	});
    	mailReceiver.setShouldDeleteMessages(false);
    	mailReceiver.setShouldMarkMessagesAsRead(false);
    
    	ThreadPoolTaskScheduler taskScheduler = new ThreadPoolTaskScheduler();
    	taskScheduler.setPoolSize(5);
    	taskScheduler.afterPropertiesSet();
    
    	DirectChannel outputChannel = new DirectChannel();
    	outputChannel.subscribe(new MyMessageHandler());
    
    	channelAdapter = new ImapIdleChannelAdapter(mailReceiver);
    	channelAdapter.setShouldReconnectAutomatically(true);
    	channelAdapter.setTaskScheduler(taskScheduler);
    	channelAdapter.setOutputChannel(outputChannel);
    	channelAdapter.start();
    } catch (IllegalStateException ise) {
    	ise.printStackTrace();
    	if (channelAdapter != null) {
    		channelAdapter.stop();
    		try {
    			mailReceiver.destroy();
    		} catch (Exception e) {
    			e.printStackTrace();
    		}
    	}
    }
    with this code i get the mailbox inbox from the admin, not from the user "user1"

    I would appreciate tips on

    greets rizzi
    Last edited by RizziCR; 09-16-2011 at 05:49 AM.

  2. #2
    yutaka is offline Project Contributor
    Join Date
    Oct 2009
    Location
    Tokyo
    Posts
    113
    Rep Power
    5

    Default

    I do not know much about spring's IMAP APIs especially about ImapIdleChannelAdapter.
    So could you tell us about that?
    By this api, what a series of commands does your source code sends to zimbra IMAP server?

  3. #3
    RizziCR is offline Member
    Join Date
    Aug 2011
    Posts
    10
    Rep Power
    4

    Default

    problem is solved.. i check every mailbox via soap inside a scheduler..

Thread Information

Users Browsing this Thread

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

Posting Permissions

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