Zimbra offers Open Source email server software and shared calendar for Linux and the Mac
Go Back   Zimbra :: Forums > Zimbra Collaboration Suite > Developers

Welcome to the Zimbra :: Forums!
Welcome, if you would like to post a comment please register. We also encourage you to explore all things Zimbra with our team and members of the community.

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1 (permalink)  
Old 09-16-2011, 05:24 AM
Junior Member
 
Posts: 9
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..
Reply With Quote
  #2 (permalink)  
Old 09-27-2011, 07:28 AM
Project Contributor
 
Posts: 92
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?
Reply With Quote
  #3 (permalink)  
Old 09-27-2011, 07:36 AM
Junior Member
 
Posts: 9
Default

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


Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes


Why Join?

Registering let's you ask questions, makes it easier to search, displays any files attached to posts, and notifies you about replies.

blog.zimbra.com




 

SEO by vBSEO ©2011, Crawlability, Inc.