To get unread messages in any folder "exactly once"

What am trying to do?
a. Poll the mail server(might be MS or gmail or yahoo..) (say now).
b. Get unread messages from a mailbox folder via IMAP. (via +'SEEN'+ flag)
c. Process the unread messages i.e. in my case i will send SMS to users according to filters specified.
d. Sleep and Poll the mail server after 10 min(say)
e. Now the question is how to do i get the next set of unread messages i.e. the unread messages other than those that i got in step (b)
Rules-
a. Note that i can't set the message as '+READ+' or '+SEEN+' as mine is not the standard client.
b. I think i can get hold of the largest message UID in the first poll and save it and in the next poll try to retrieve only the unread
messages with UID greater than that i saved. +But is there any good and easy approach to do the above+?
c. Also to be clear, in the interim period between two polls, if the user really reads a mail via his/her client, then in the next poll i am not interested in those read mails. So the question arises only if the user doesn't check any mail where my application really comes into picture
Please assist. Ping me if am unclear.

Thanks. It's working for 'IMAP'. I need it for IMAP only.

Similar Messages

  • Cannot synch my ipod.when i connect it and hit synch i get a message saying file folder cannot be found or does not recognize ipod. Any ideas?

    cannot synch my ipod classic. when i try to i get a message saying "file folder cannot be found" or ipod is not recognized. Anybody have any ideas or fixes for this?

    Mine is doing the same thing, I have been seeing it happen to a lot of people lately. Maybe it's the company sent out a bug to crash old Ipod, so we would have to buy new ones.

  • I downloaded the newest version of firefox. Now I just keep getting a mesage to restart my computer. I have restatrted numerous times and keep getting same message. Any suggestions

    I downloaded the newest version of Firefox. Now I just keep getting a message to restart my computer. I have restarted numerous times and keep getting same message. Any suggestions edit

    Hi Dann, did you delete to the Recycle Bin, or did you do a more drastic permanent delete (e.g., Shift+Delete) or empty the Recycle Bin?
    ''If you think it might be in the Recycle Bin:''
    First, make sure hidden folders are viewable. You can do that using Windows Explorer or My Computer > Tools > Folder Options > View tab. Look for the radio buttons to show or not to show hidden files and folders.
    Now look for C:\Documents and Settings\''username''\Application Data\Mozilla\Firefox\Profiles or some part of that path, or your actual profile folder, which would have had a semi-random name, typically ending with default, or the bookmarkbackups folder, which is the ultimate prize.
    ''If it's not in the Recycle Bin:''
    To recover your old Firefox settings folder (profile folder), try using a utility like Piriform's Recuva:
    http://www.piriform.com/recuva
    That needs to run ASAP before deleted files are overwritten.
    The folder you're looking for would have had a semi-random name, but be located here:
    C:\Documents and Settings\''username''\Application Data\Mozilla\Firefox\Profiles
    By default, that folder is hidden. Make sure hidden folders are viewable. You can do that using Windows Explorer or My Computer > Tools > Folder Options > View tab. Look for the radio buttons to show or not to show hidden files and folders.
    In particular, a bookmarkbackups folder would be a wonderful thing to be able to recover.
    Hopefully one of these methods will work for you.

  • Can't move/drag messages to any folder in Outlook 2011 for Mac

    Can't move/drag messages to any folder in Outlook 2011 for Mac
    any help?

    I had the same problem since last Thursday.  I have tried and re-tried all of the settings suggested by the support posts but I can not get email to go out of me Outbox.

  • Trying to download itunes keep getting error message 2, any suggestions?

    trying to download itunes keep getting error message 2, any suggestions?

    See Troubleshooting issues with iTunes for Windows updates.
    tt2

  • I keep getting the following message on my phone "Sorry!  The application Email (processcom.andriod.email) has stopped unexpectedly.  Please try again"  and there is a force shutdown button, which I push but keep getting the message.  Any ideas how to mak

    I keep getting the following message on my phone "Sorry!  The application Email (processcom.andriod.email) has stopped unexpectedly.  Please try again"  and there is a force shutdown button, which I push but keep getting the message.  Any ideas how to make it go away so I can get my emails?

    Have you installed any applications recently?  A task killer maybe?  You can try rebooting the phone and see if that helps.

  • When I tried to open itunes I was informed files were missing and I needed to reinstal . I have attempted to do this but keep getting fault messages. Any idea's pleasel

    When I tried to open itunes I was informed files were missing and I needed to reinstal . I have attempted to do this but keep getting fault messages. Any idea's please

    C:\Users\paphos203\Downloads\iTunesSetup(2).exe.part could not be saved, because the source file could not be read.
    Try again later, or contact the server administrator.
    C:\Users\paphos203\Downloads\iTunesSetup(4).exe.part could not be saved, because an unknown error occurred.
    Try saving to a different location

  • How to get unread message count

    I m working in mail application where i need to get the unread message count.Can anyone help me out in solving this issue ,is there any specific method available in javamail to get this count.
    Thanx in Advance

    Is there some reason you're unable to read the
    javadocs? Did you find them too confusing?
    What's wrong with the method Folder.getUnreadMessageCount?
    Oh, and if you're using POP3 instead of IMAP,
    read the FAQ and the com.sun.mail.pop3 package
    javadocs.

  • How can I get my e-mails when I get a message that the folder inbox is full?

    I can't get my e-mail and the e-mails in my inbox have disappeared from Thunderbird, (but not from my server's web mail), so I can't divide it into several folders on Thunderbird to alleviate the problem. I don't know what happened to my old e-mails and I can't get new ones. I did go to my server's web site and deleted a huge number of e-mails there, but that didn't solve the problem. In fact, I wonder if this procedure caused my inbox to somehow disappear in Thunderbird.
    I get a message that says "The folder inbox is full and can't any more messages. To make room for more messages delete any old or unwanted mail and compact the folder."
    I have a new Mac with Maverick. However, in case this matters, all of my old files were migrated to the new Mac, including e-mails. Most of the old e-mails are in a separate folder, however. How can I restore my inbox and also get new e-mails?
    Thank you very much.
    I just thought of something else. I just changed my password with the server. Could this be the problem? I am able to *send* e-mail with Thunderbird, however.
    rteach1

    Technically the limit of 4Gb per folder should have been removed in a recent patch. Personally I an unconvinced as the developers have said so twice before and something else arose to bite people at 4Gb. So the limit probably does not exist anymore and moving mail and compacting will fix it without data loss if it occurs as recent issues have been about displaying mail after the 4Gb point, not storing it.
    Use the Ctrl and Shift keys in conjunction with your mouse to make multiple selections.
    click followed by Shift+ Click selects everything between the two clicks, including the items clicked.
    Holding the Ctrl key while clicking allows you to select or deselect mail to either fine turn the list from shift clicking or to make one of your own.
    Ctrl +A selects everything in the list from the current selection to the end.
    One option is create an important folder and move your important stuff to it then ctrl +A the whole remaining inbox.

  • How to get unread messages

    Hi,
    I have the following code
    Folder folder=store.getFolder("INBOX");
    Message[] message=folder.getMessages();
    The getMessages method is supposed to return all the messages from inbox,but I only get new messages.I can read the new message but,how can I mark the message that I already read.When I run my program,it always reads all the new messages.What I mean is,in outlook,all the new messages are highlighted,my program can always read those.How can I make the message without highlight.I am using POP3 for incoming mail.
    Thanks
    Ravi.

    hello friends if you are reading mail from gmail use following properties
    props=System.getProperties();
                 props.setProperty( "mail.imap.socketFactory.class", "javax.net.ssl.SSLSocketFactory");
                props.setProperty( "mail.imap.socketFactory.fallback", "false");
                props.setProperty("mail.imap.port", "993");
                props.setProperty("mail.imap.socketFactory.port", "993");// for gmail
                   props.put("mail.imap.host", "imap.gmail.com");
    auth=new SMTPAuthenticator("[email protected]","password");
                      session=Session.getDefaultInstance(props,auth);
              store=session.getStore("imap");
    by checking flag values you can differentiate mail is read or unread
         Flags flags=msg[k].getFlags();
                            Flags.Flag[] sf=flags.getSystemFlags();
                   for (int i = 0; i < sf.length; i++) {
                      if (sf[i] == Flags.Flag.DELETED)
                          System.out.println("DELETED message");
                           else if (sf[i] == Flags.Flag.SEEN)
                          System.out.println("SEEN message");
                          else if (sf[i] == Flags.Flag.ANSWERED )
                          System.out.println("ANSWERED  message");
                          else if (sf[i] == Flags.Flag.DRAFT )
                          System.out.println("DRAFT  message");
                          else if (sf[i] == Flags.Flag.FLAGGED)
                          System.out.println("FLAGGED message");
                          else if (sf[i] == Flags.Flag.RECENT)
                          System.out.println("RECENT message");
                          else if (sf[i] == Flags.Flag.USER)
                          System.out.println("USER message");
    or check
    msg[k].isSet(Flags.Flag.SEEN)
    is true or false

  • To get unread messages Pop3 vs IMAP

    Hi all.
    I read all API's documentation and I have this common trouble; I understood that with pop3 it's not possible to read flags and get unread mails.So, can I have some links with the official documentation about imap protocols to get unread mails?

    I tried with the HashMap and I wrote this code:
                          ObjectOutputStream out = new ObjectOutputStream(new FileOutputStream("uid.txt"));
                                   HashMap2<String, String> hash  = new HashMap2<String, String>();
                        POP3Folder folderPOP = (POP3Folder) folder;
                        Message[] messages = folderPOP.getMessages();
                        for(int i = 0; i<messages.length; i++){
                             String uid = folderPOP.getUID(messages);
                             hash.put(uid, uid);
                        out.writeObject(hash);
    out.close();
    folder.close(false);
                   store.close();
                        This one save all UIDs in a file named 'uid.txt'.
    Then, with a new session, store and folder, I query inbox to get unread mails:POP3Folder folderPOP = (POP3Folder) folder;
                        Message[] messages = folderPOP.getMessages();
                        ObjectInputStream in = new ObjectInputStream(new FileInputStream("uid.txt"));
                        HashMap2<String, String> hash = (HashMap2<String, String>) in.readObject();
                        for(int i =0; i<messages.length; i++){
                             String uid = folderPOP.getUID(messages[i]);
                             if(!hash.containsKey(uid)){
                                  System.out.println("New message from: " +messages[i].getFrom()+ " subject: " +messages[i].getSubject());
                        in.close();
    folder.close(false);
                   store.close();HashMap2 is a Class which extends HashMap and implements Serializable interface.
    This code doesn't work. It says that there aren't new mails!
    Where am I wrong?
    Edited by: Kondarondus on Feb 23, 2009 4:51 AM                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                           

  • I am trying to download the latest iTunes update.  Keep getting error message stating "The folder path 'My Documents' contains an invalid character".  I can't uninstall iTunes for the same reason.  HELP!

    I am trying to download the latest iTunes update; keep getting error message that says "The folder path 'My Documents' contains an invalid character".  This also happens when I try to uninstall iTunes.  HELP!

    OK, never mind!  I saw another question on the right side that addressed the problem, and it worked perfectly!  Went to Major Geeks' page, downloaded the Windows Installer Cleanup Utility, and was able to reinstall the updated version of iTunes!  This community is super!

  • I cant update my apps.  I just get this message.  Any help is appreciated.  To update this application, sign in to the account you used to purchase it.

    Upgraded to OX Mt Lion and the app store wants to update iMovie and iPhoto.  When I hit the update button I get this message.
    To update this application, sign in to the account you used to purchase it.

    So do it.

  • Hi,i cannot log into my itunes account,keep getting error message-0x800b0101,any help,on windows vista

    hi,error message appears anytime i try to use anything on the itunes menu,installed the latest updates and still no change.i can play song samples but cant purchase tracks etc....any help out there???

    Same problem. I can see the itunes store so not a problem with windows firewall. The account is active on my iphone so i know i am not locked out. I can connect the PC to my iphone so i know itunes is working ok. It is just logging into itunes on this pc which doesn't work. Only thing I can think of is that the email address I use for my apple id has been offline for a while and is working again now, I'm wondering whether this has been the case for others who are having this issue?

  • Trying to download photos from camera to iPhoto, get "unreadable" message

    Am trying to download photos from camera to iPhoto, and iPhoto won't take the photos, saying "unreadable files".  I've downloaded from this memory card and camera before.  Why is it now saying my photos are "unreadable" and how do I correct it? 

    Have you tries Image capture (in your applications folder)?
    Will the camera mount to the desktop?
    When did you last reformat the card?
    LN

Maybe you are looking for

  • Safari 5.1 Crash in Lion

    I am having issues with safari 5.1 crashing. Happens in a number of circumstances such as trying to clicking on mail to links in web pages. Also, when trying to open java program. Here is the last crash log.  Any help would be appreciated. Thanks in

  • J2SDK 1.4.2 download package

    With 1.4.0 I was able to download a package and then copy that package locally to multiple machines. With 1.4.2, however, the "package" is only a small bootstrap installer, which means I need to download the whole 37MB on each machine I wish to insta

  • Help with linking files

    I have several projects with 1000's of little clips in them- that have become unlinked- normally I can just use link media and that resolves it, but it seems like there has been either name changes to them (numbering in project panel seems different)

  • GR non-valuated Display

    Is there any way to hide or grey out the GR non-valuated field in the purchase requisition and/or the purchase order?  In customizing I've set this field to be flagged and I don't want the user to be able to change. Edited by: Doug Pearce on Jan 15,

  • TS4000 Reminders and Iphone 4: Updating a Reminder Notes field that is more than 15 lines causes an usability bug

    ..you can't see what you are typing as it is covered by the "Details" top bar...It is almost impossible to update the Notes field of these reminders