problem while trying to retrive only unread mails only
1 posts in topic
Flat View  Flat View
TOPIC ACTIONS:
 

Posted By:   sambasivarao_damerla
Posted On:   Tuesday, October 12, 2004 04:52 AM

Hi everyone, Please help me. Iam using the following code its alway reading all the messages from the server. But my requiremenet i want to read only unread mails everytime. Onec i read that mail i want to set that flag as SEEN. But i don't want to delete this mail from ther server once i read that. The problem what iam facing is i am alway reading all the mails. in the console it printing the SetFlag for SEEN is false before read and true after read. But if i restart the application its showing the FLAG as false only. Hence its reading all the messages againg.(ie,.. its not setting the flag in to the server Store store = session.get   More>>

Hi everyone,

Please help me. Iam using the following code its alway
reading all the messages from the server. But my
requiremenet i want to read only unread mails
everytime. Onec i read that mail i want to set that flag as
SEEN. But i don't want to delete this mail from ther
server once i read that.



The problem what iam facing is i am alway reading all the
mails. in the console it printing the SetFlag for SEEN
is false before read and true after read. But if i
restart the application its showing the FLAG as false
only. Hence its reading all the messages againg.(ie,..
its not setting the flag in to the server


Store store = session.getStore("pop3");

// Connect to store

store.connect(host, username, password);

// Get folder

Folder folder = store.getFolder("INBOX");

// Open read-only

folder.open(Folder.READ_WRITE);

// Get directory

message = folder.getMessages();

for (int i = 0, n = message.length; i < n; i++)

{


System.out.println("$$$$$$$$$$$$ Flag of the message for i : "+i+"is |"+message[i].isSet(Flags.Flag.SEEN));


if (!message[i].isSet(Flags.Flag.SEEN))

{

// Display from field and subject

System.out.println(i + ": " + message[i].getFrom()[0] + " " + message[i].getSubject());



// Display message content

System.out.println(message[i].getContent().toString());

message[i].setFlag(Flags.Flag.SEEN, true);

}

System.out.println("$$$$$$$$$$$$ After Read Flag of the message for i:"+i+"is |"+message[i].isSetFlags.Flag.SEEN));

}

// Close connection

folder.close(true);

store.close();



PLZ PLZ SOME PLZ HELP ME

Thanks in advance

sambadamerla

   <<Less

Re: problem while trying to retrive only unread mails only

Posted By:   Anonymous  
Posted On:   Monday, November 8, 2004 05:50 PM

pop3 only supports the DELETED flag. You can only use SEEN if you are using imap and your server supports it.
About | Sitemap | Contact