Javamail problem with SEEN flags (Autmatically updates the server)

Hi all,
I am using Javamail 1.4.
When I read a message I used to get "java.io.IOException: No content" exceptions. Then I have created new MimeMessage from folder.getMessage() return as below
1) MimeMessage m = (MimeMessage)foldergetMessage(i);
2) MimeMessage mimeMsg = new MimeMessage(m);
After doing this I am seeing all my unread mails are shown as read in my server (thru' server's web access).
This is happening with step 2) only. If I comment out step 2, i will be getting others errors like, No content/BODY STRUCTRUE etc..
Am I doing anything wrong here?

Hi,
This is my client which reads the mail. I am using EmailArchitect as mail server.
I had few mails unread before executing this piece of code. But after when I saw the messages in server, they are shown as read.
package com.imap.client;
import java.util.*;
import java.io.*;
import javax.mail.*;
import javax.mail.internet.*;
import javax.mail.search.*;
import javax.activation.*;
public class ReadMail {
    public static void main(String[] args) throws IOException {
        getMessages();
        //getMessages();
     private static void getMessages() throws IOException {
          // SUBSTITUTE YOUR ISP's POP3 SERVER HERE!!!
        String host = "mail.com";
        // SUBSTITUTE YOUR USERNAME AND PASSWORD TO ACCESS E-MAIL HERE!!!
        String user = "[email protected]";
        String password = "password";
        // SUBSTITUTE YOUR SUBJECT SUBSTRING TO SEARCH HERE!!!
        String subjectSubstringToSearch = "Test E-Mail through Java";
        // Get a session.  Use a blank Properties object.
        Session session = Session.getInstance(new Properties());
        try {
            // Get a Store object
            Store store = session.getStore("imap");
            store.connect(host, user, password);
            // Get "INBOX"
            Folder fldr = store.getFolder("INBOX");
            Folder defFldr = store.getDefaultFolder();
            fldr = defFldr.getFolder("INBOX");
            fldr.open(Folder.READ_ONLY);
            int count = fldr.getMessageCount();
            System.out.println(count  + " total messages");
            // Message numebers start at 1
            for(int i = 1; i <= count; i++) {
          // Get  a message by its sequence number
                //Message m = (MimeMessage)fldr.getMessage(i);
                 MimeMessage m = (MimeMessage)fldr.getMessage(i);
                MimeMessage mimeMsg = new MimeMessage(m);
            // "true" actually deletes flagged messages from folder
            fldr.close(true);
            store.close();
        catch (MessagingException mex) {
            // Prints all nested (chained) exceptions as well
            mex.printStackTrace();
} //End of classThanks,
Rama

Similar Messages

  • Hello, I have a problem with iPhone 5c softhware update ( The iPhone "iPhone" could not be restored. An unknown error occurred (27))

    Hello, I have a problem with iPhone 5c softhware update ( The iPhone "iPhone" could not be restored. An unknown error occurred (27))

    Error 1 or -1
    This may indicate a hardware issue with your device. Follow Troubleshooting security software issues, and restore your device on a different known-good computer. If the errors persist on another computer, the device may need service.
    The" may need service' meand there is a hardware problem. In that case make an appointment at the Genius Bar of an Apple store.
      Apple Retail Store - Genius Bar

  • Time Machine - Problem with establishing a connection to the server

    Using LionMac OS X Version 10.7 and when attempting to setup Time Machine to make backupto my ReadyNas Duo, the setup fails and I receive the following message(translated from Danish):
    “There wasa problem with establishing a connection to the server ”SERVERNAME”.
    The versionof the server that you attempt to establish connection to, is not supported.Contact the system administrator to solve the problem.”
    Any ideasfor a solution?

    Please follow these instructions:
    Lion: Connecting to legacy (pre-Lion) AFP services - and Mac OS X (server):
    https://discussions.apple.com/thread/3258472

  • Problems with User Accounts connecting to the server

    I created couple of user accounts but the users can not connect to their accounts from the computer lab. i want to know how properly set the accounts to login to any computer in the lab.

    Welcome to the forums. You need to:
    1. Bind your desktop machines to your Open Directory master
    2. Create groups and user accounts in WorkGroup Manager which allow your users to log into those computers
    You will find the User Admin documents here useful:
    http://www.apple.com/server/documentation/
    hth,
    b.

  • Good evening I would please help me, IGood evening I would please help me, I have problems with flash player when update on my computer Flash Player for windows 8, gives me error in the installation that is not apply on my computer. Please help. Thank You

    Good evening I would please help me, IGood evening I would please help me, I have problems with flash player when update on my computer Flash Player for windows 8, gives me error in the installation that is not apply on my computer. Please help. Thank You

    First, confirm that ActiveX Filtering is configured to allow Flash content:
    https://forums.adobe.com/thread/867968
    Internet Explorer 11 introduces a number of changes both to how the browser identifies itself to remote web servers, and to how it processes JavaScript intended to target behaviors specific to Internet Explorer. Unfortunately, this means that content on some sites will be broken until the content provider changes their site to conform to the new development approach required by modern versions of IE.
    You can try to work around these issues by using Compatibility View:
    http://windows.microsoft.com/en-us/internet-explorer/use-compatibility-view#ie=ie-11
    If that is too inconvenient, using Google Chrome may be a preferable alternative.

  • Has anyone else had a problem with data? after updating my phone to the new update, i have all this data, and keep getting notifications that my data is getting high. i never had this problem before.

    has anyone else had a problem with data? after updating my phone to the new update, i have all this data, and keep getting notifications that my data is getting high. i never had this problem before.

    fair enough.  No need for any unnecessary posts either.  You issue had been addressed ad nauseum already in this forum had you bothered to search this forum (as forum etiquette would dictate) before posting.
    In any case, I hope that your problem was solved.

  • HT1222 I have iphone 4 and the software is ios 7.0.2. I am facing problems with my phone. Since the last software update my phone has started giving problems. like it hangs sometime when i recieve an incoming call. The carrier status bar shifts down a bit

    I have iphone 4 and the software is ios 7.0.2. I am facing problems with my phone. Since the last software update my phone has started giving problems. like it hangs sometime when i recieve an incoming call. The carrier status bar shifts down a bit and sometimes it vanishes automatically. I,m confused.
    Secondly i have an update IOS 7.0.4 waiting in my Software Update menu. I have tried so many times to update my iphone but it always fails to update the IOS 7.0.4. Any body suggest anything regarding this

    Wow. Lots of help. Thanks apple

  • I have been having problems with my speaker. After the recent update I am unable to listen to movies or music using my speaker. The volume bar is completely missing. If I plug a headset into the port, the volume bar reappears.

    I have been having problems with my speaker. After the recent update I am unable to listen to movies, music or apps using my speaker. The volume bar is completely missing. If I plug a headset into the port, the volume bar reappears and then disappears after the headset is removed. This is quite annoying. My child's Apps that he likes to play will not even make a sound. HELP!!!

    Do a reset (Hold Sleep/Wake and Home buttons about 10 secs or more till Apple logo appears, ignore the Slide to Power Off that appears)
    Note: You will not lose any data.

  • HT204490 OS X Yosemite v10.10.3 Update - I had problems with my iMac after installing the previous update and I removed that update.  Have there been problems associated with this update ?

    OS X Yosemite v10.10.3 Update - I had problems with my iMac after installing the previous update and I removed that update.  Have there been problems associated with this update ?

    I've been using it on all of my computer without any problems. Remember you won't see any positive comments here. Everyone here is complaining about a problem. If you want a good experience with any upgrade or update first make a backup from which you can boot the computer. If you are installing an update, like 10.10.3 for example, always download and install the Combo Updater - OS X Yosemite 10.10.3 Combo Update. Before you install any update or upgrade over an existing system you should do this:Repair the Hard Drive and Permissions:
    Boot to the Recovery HD:
    Restart the computer and after the chime press and hold down the COMMAND and R keys until the menu screen appears. Alternatively, restart the computer and after the chime press and hold down the OPTION key until the boot manager screen appears. Select the Recovery HD and click on the downward pointing arrow button.
    Repair
    When the recovery menu appears select Disk Utility and press the Continue button. After Disk Utility loads select the Macintosh HD entry from the the left side list.  Click on the First Aid tab, then click on the Repair Disk button. If Disk Utility reports any errors that have been fixed, then re-run Repair Disk until no errors are reported. If no errors are reported click on the Repair Permissions button. Wait until the operation completes, then quit Disk Utility and return to the main menu. Select Restart from the Apple menu.

  • Is anyone else having problems with there phone freezing after the 8.0 update?

    iis anyone else having problems with there phone freezing after the 8.0 update??

    Hello Chefboyharley,
    Thanks for the question. After reviewing your post, it sounds like the phone is unresponsive. I would recommend that you read this article, it may be able to help you resolve or isolate the issue.
    iOS: Not responding or does not turn on
    Thanks for using Apple Support Communities.
    Have a nice day,
    Mario

  • Looking for a site that shows problems with windows patches or updates.

    Looking for a site that shows problems with windows patches or updates...so I know what not to install.
    Plenty of sites list and summarize individual patches, I want one that consolidates problems and complaints so I can better assess the risk. Currently I'm waiting to install patches several days and doing google searches. That works, but I'd rather find a place
    that does it with expertise.
    Which forums would be best to look for such problems.
    Thanks in and advance for suggestions

    Hi,
    I agreed with Cyber and Rick.
    Windows update helps to keep your PC safer—and your software current—by fetching the latest security and feature updates from Microsoft via the Internet.
    Although there might be some problems when installing it, Windows update is not the one to blame.
    For troubleshooting Windows updates, if needed:
    Fix Microsoft Windows Update Issues
    http://support2.microsoft.com/gp/windows-update-issues
    Best regards
    Michael Shao
    TechNet Community Support

  • Problem with Lightning Adapter after update to IOS 8.1

    Dear all,
    last week I updated the Iphone 5S of my wife with IOS 8.1 since that time we can not connect the B&W Bowl via lighning adapter (Original Apple).
    Before never any problem. I have the new Iphone 6 but IOS 8.02 and no any problem with same adapter to connect the B&W Bowl.
    I also checked in my car same problem with IOS 8.1 we can not connect but with 8.02 no problem.
    I contacted the Apple support and it looks it´s a problem with the new IOS 8.1.
    Does anybody have the same problems with the connection to Docking Stations etc ?
    best regards
    Jens

    measure the speed with speedtest http://www.speedtest.net
    and maybe contact your carrier

  • A problem with Nokia 5530 wirmware updating! Help!

    Hi all,
    I have meat the problem with Nokia 5530 firmware updating: updating allways finish with the message "Downloading of the variant package failed.Most probably there is non-commercial software in your device."
    Is there any solution for that problem?
    Thanks and regards,
    Alexander

    first its ok
     then
    translation:
    For a better connection please insert the usb-cable directly in to the computer and not trough a usb-hub or -keybord or a dockingstation of a laptop.
    Nokia Software Updater has tried downloading the software, but this is failed 4 times.
    Its posible that it can be caused by a bad, slow or instable internet connection.
    This failure can also occur because we have maybe a problem with our servers.
    try later again
    i tried it on 2 PCs one with vista and one with XP plz help me
    Message Edited by progunnl on 13-Mar-2009 02:50 PM

  • Has ayone experienced any problems withe latest apple tv update

    who has experienced problems withe latest apple tv update???

    Welcome to the Apple community.
    There are always a few that experience some problem or other after an update. Exactly what problems are you having please.

  • I've a problem with my account , mainly in the payment method " security code is invalid" this the current situation wgat can i do ???

    I've a problem with my account , mainly in the payment method " security code is invalid" this the current situation what can i do ???

    you need to update your payment information to insert the correct security code.
    http://support.apple.com/kb/ht1918

Maybe you are looking for