Retrieve messages from Exchange Inbox in Unix
0 posts in topic
Flat View  Flat View
TOPIC ACTIONS:
 

Posted By:   wu_jian
Posted On:   Thursday, May 17, 2001 11:42 PM

I coded a short class to read the messages from Exchange Inbox and it works perfectly in DOS, but when I copied the class to an Unix server, it always throws exceptions: MessagingExceptoin: javax.mail.MessagingException: A3 NO There is no replica for that mailbox on this server.; nested exception is: com.sun.mail.iap.CommandFailedException: A3 NO There is no replica for t hat mailbox on this server. MessagingExceptoin: A3 NO There is no replica for that mailbox on this server.; nested exception is: com.sun.mail.iap.CommandFailedException: A3 NO There is no replica for t hat mailbox on this server. I've verified the connection in my class so I'm pretty sure the St   More>>

I coded a short class to read the messages from Exchange Inbox and it works perfectly in DOS, but when I copied the class to an Unix server, it always throws exceptions:

			
MessagingExceptoin: javax.mail.MessagingException: A3 NO There is no replica for
that mailbox on this server.;
nested exception is:
com.sun.mail.iap.CommandFailedException: A3 NO There is no replica for t
hat mailbox on this server.
MessagingExceptoin: A3 NO There is no replica for that mailbox on this server.;
nested exception is:
com.sun.mail.iap.CommandFailedException: A3 NO There is no replica for t
hat mailbox on this server.


I've verified the connection in my class so I'm pretty sure the Store is connected to my Exchange account.
Any kind soul there can help?

The class is attached and compilable.
The parameters to provide are:
1. host - Exchange server IP or hostname
2. username - domain/username
3. password - password
			
				
import javax.mail.*;
import javax.mail.internet.*;

public class UC_ReadMail
{
public void readMail(String host, String username, String password)
{
System.out.println("host = [" + host + "]");
System.out.println("username = [" + username + "]");
System.out.println("password = [" + password + "]");

try
{
// Get session
Session session = Session.getInstance(System.getProperties(), null);

// Get the store
Store store = session.getStore("imap");
store.connect(host, username, password);
System.out.println("isConnected = [" + store.isConnected() + "]");

// Get folder
Folder folder = store.getFolder("INBOX");
System.out.println("folderExist = [" + folder.exists() + "]");
System.out.println("folder fullname = [" + folder.getFullName() + "]");
folder.open(Folder.READ_ONLY);

// Get directory
Message message[] = folder.getMessages();
for (int i=0, n=message.length; i
{
System.out.println(i + ": " + message[i].getFrom()[0]
+ " " + message[i].getSubject());
System.out.println("content = [" + (String)message[i].getContent()
+ "]");
}

// Close connection
folder.close(false);
store.close();
}
catch (MessagingException me)
{
System.out.println("MessagingExceptoin: " + me);
System.out.println("MessagingExceptoin: " + me.getMessage());
}
catch (Exception e)
{
System.out.println("Exception:" + e.getClass().getName() + " hit");
System.out.println("Exceptoin " + e);
}
}

public static void main (String args[]) throws Exception
{
String host = args[0];
String username = args[1];
String password = args[2];
UC_ReadMail uc = new UC_ReadMail();
uc.readMail(host, username, password);
}
}
   <<Less
About | Sitemap | Contact