• Post Reply Bookmark Topic Watch Topic
  • New Topic

javax.mail Exceptions  RSS feed

 
sahahars shalev
Greenhorn
Posts: 2
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
<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[i].getFrom()[0]
+ "\t" + message[i].getSubject());
//openMessage.setMessage(message[i]);
//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
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!