The Artima Developer Community
Sponsored Link

Java Answers Forum
1) Javax.mail:pop3,imap

0 replies on 1 page.

Welcome Guest
  Sign In

Go back to the topic listing  Back to Topic List Click to reply to this topic  Reply to this Topic Click to search messages in this forum  Search Forum Click for a threaded view of the topic  Threaded View   
Previous Topic   Next Topic
Flat View: This topic has 0 replies on 1 page
shahar

Posts: 2
Nickname: shaharke
Registered: Mar, 2003

1) Javax.mail:pop3,imap Posted: Mar 9, 2003 9:26 AM
Reply to this message Reply
Advertisement
<p>
1) POP3 messages are read-only
javax.mail.IllegalWriteException: POP3 messages are read-only,
2) java.io.EOFException: EOF on socket
javax.mail.MessagingException: Open failed;
3) java.net.NoRouteToHostException: Operation timed out: no further information
javax.mail.MessagingException: Operation timed out: no further information;

first Exception accurse when I try to send a message that is already in my inbox and re Write the ?to? field exception points to message.setFrom() and cant rewrite that field on an existing message

second Exception accurse when receiving large ziped file throw pop3 it work fine for small txt file receiving
third Exception accurse when trying to connect to my host throw imap works fine when I connect with pop3
few more problems:
4) how can I work with several folders throw imap or pop3 in terms of handling messages between the different folders (copy,delete,setting and getting)
5) can I have physical folder and get set messages to her I did not succeed in fetching messages from a folder with out operate the store.connect( ) method first which is an expansive operation.
6) when I receive messages with my out look express they disappear from the
Javax.mail folder(inbox) who can I prevent this
7)what general changes do I need to do using imap instead of po3
the next code was making the above Exceptions
<font size=2><pre>
public void actionPerformed(ActionEvent e){
try{
if(!store.isConnected()){
//CONNECT IF NOT ALLREADY CONNECTED
store.connect(inputData.data.getHost(), inputData.data.getUserName(), inputData.data.getPassword());//host, username, password
}
System.out.println("SendReciveMail was pressed");
folder = store.getFolder("INBOX");
System.out.println("Folder name is " + folder.getName());
if(!folder.exists()){
folder.create( Folder.HOLDS_MESSAGES);
}
folder.open(Folder.READ_WRITE);// SECONDE EXCEPTION HERE

Message message[] = folder.getMessages();
for (int i=0, n=message.length; i<n; i++)
System.out.println(i + ": " + message.getFrom()[0]
+ "\t" + message.getSubject());
//openMessage.setMessage(message);
//openMessage.actionPerformed(e);
}

// Close connection
folder.close(false);
store.close();
} catch(Exception ex) {
System.out.println(ex.getMessage());
ex.printStackTrace();
}

}
/************************************************************/
ANOTHER FUNCTION(sets the session props
and store one time at the beginning of the program
they are private data member shard by both functions )
public void initialData(){
// Get system properties
props = System.getProperties();
// Setup mail server
// props.put("mail.imap.host",inputData.data.getHost());//host
props.put("mail.smtp.host",inputData.data.getHost());//host

// Get session
session = Session.getDefaultInstance(props, null);

try {
// Get the store
store = session.getStore("pop3");
//store = session.getStore("imap");
if(!store.isConnected()){
//CONNECT IF NOT ALLREDY CONNECTED
store.connect(inputData.data.getHost(), inputData.data.getUserName(), inputData.data.getPassword());//host,
// username, password //MAKE THIRD
//EXCEPTION USING IMAP
}
} catch(Exception e) {
System.out.println(e.getMessage());
e.printStackTrace();
}

}
/*******************************************************************/
< /pre></font>
<p>
all the data use by the function checked to be ok
write me to shaharke1@bezeqint.net

Topic: How can I set the path and the CLASS PATH in java Previous Topic   Next Topic Topic: Running Sun's applet demos

Sponsored Links



Google
  Web Artima.com   

Copyright © 1996-2019 Artima, Inc. All Rights Reserved. - Privacy Policy - Terms of Use