Javamail delete mail in READ_ONLY mode

Hello,
I want to fetch my GMail mails without deleting. My example code fetch e-mails, but the mail is delete from GMail account. I observe, that the line where is message.getContent() delete mail. If I remove this, the message is still alive. Thanks for any help.
                          String SSL_FACTORY = "javax.net.ssl.SSLSocketFactory";
          Properties pop3Props = new Properties();
          pop3Props.setProperty("mail.pop3.socketFactory.class", SSL_FACTORY);
          pop3Props.setProperty("mail.pop3.socketFactory.fallback", "false");
          pop3Props.setProperty("mail.pop3.port", "995");
          pop3Props.setProperty("mail.pop3.socketFactory.port", "995");
          URLName url = new URLName("pop3", "pop.gmail.com", 995, "", "login", "password");
          Session session = Session.getInstance(pop3Props, null);
          Store store = new POP3SSLStore(session, url);
          store.connect();
          // Get folder
          Folder folder = store.getFolder("INBOX");
          folder.open(Folder.READ_ONLY);
          // Get directory
          Message message[] = folder.getMessages();
          for (int i = 0, n = message.length; i < n; i++)
               System.out.println(message.getFrom()[0] + "\t"
                         + message[i].getSubject());
// HERE IS PROBLEM
               System.out.println("Content: " + message[i].getContent());
          // Close connection
          folder.close(false);
          store.close();
Message was edited by:
NullpointerForever

There are settings in Gmail that control which messages are visible
to the POP3 client.

Similar Messages

  • What Became of Trash & Deleted Mail

    Hi All, Just starting using, Leopard 10.5.3 & Apple Mail Version 3.3 (924).
    When I used previous versions of Apple Mail there were 2 mailboxes, that now seem to have vanished with new version of Apple Mail, those are: Trash & Deleted Mail.
    Trash is not in the list under Mailboxes:
    InBox
    Drafts
    Sent
    I have: repaired permissions, re-started in Safe Mode, and still, there is no Trash icon, and no mailbox for Deleted Mail and re-started in Admin Acct.
    In Apple Mail Prefs>General>
    "When searching all mailboxes, include results from:"
    Each of the following boxes is checked: Trash, Junk, Encrypted
    Junk Mail Filtering is not enabled.
    Thanks for your insight.

    LOL..when I first deleted an email, I found there was no trash can! Next, I looked for "deleted messages", but could not find them. Even looked in Trash can on the dock.
    Did both an Apple Mail & Spotlight Search for, the emails, all to no avail.
    I also use Spam Sieve, and turned it off.
    This iMac is new to me, so, I had used Migration Assistant to transfer everything via FW. Seemed to be fine. All my prefs, files, folders, settings, etc. made the move.
    Luckily, I can recover what I accidentally deleted by going to verizon.net and looking at mail there.
    Thanks for your interest & assistance.

  • Why can't I delete Mail from my iPhone? it just allows me to Archive, and where do the archives go?

    Why can't I delete Mail from my iPhone? it just allows me to Archive, and where do the archives go?

    You'll have to go to your Settings -> Mail, Contacts, etc -> Email Account -> Advanced -> Deleted Mailbox
    Turn off Archive mode, Turn on Trash
    You can also put the phone in airplane mode to delete them real quick, but that's only a temporary fix.

  • Issue Deleting Mail

    Hi All,
    I have an iphone 3gs with 3.1.3 and many times i get an error when deleting mail that says "Unable To Move Message, The message could not be moved to mailbox trash".
    I have read about putting iphone into flight mode then deleting it but that worked once and i get the error again.
    Can someone please help with this error?
    Cheers

    Is this an IMAP or Exchange account? I will occasionally get that error when I'm trying to delete mail in my Exchange account. What it generally means is the phone cannot communicate with the server, thus it will not delete the mail. It could be for any number of reasons, and I can get it while on the cellular network as well as wifi. I just leave the mail there and try to delete it later and everything works.
    The airplane mode trick only works with POP accounts, and generally just when you get an error sending a mail. That way you can open the Mail app without it connecting to the server and getting locked in the send cycle again.

  • I cannot delete mail folders from any of my accounts

    I Have just updated my iPad to iOS 8 and now I cannot delete any of the folders that are in my mail boxes. Every time I hit the delete button in edit mode the iPad just bounces back to ipad home page.

    Swiping works to delete e-mails in a folder but does not delete an e-mail folder. I have tried the edit folders then clicking on delete and again it just flashes back to the iPads home page. It worked before I did the update to iOS 8 so must be a programming glitch.

  • Mail app won't permenently delete mail

    It deletes the stuff on the email accounts on the net, but it wont delete stuff its downloaded onto my comp. I select it, and delete it, and then when I come back to the mail app, its there again. Ive tried the erase deleted mail option, but it still shows up the next time i got to the mail app. Any ideas what to do?

    Interesting that it works fine in Safe Mode, but the problem returns if you start up normally again. The following is what I usually suggest as a first step when Mail freezes on launch. I wonder whether it’ll work for you as well...
    Verify/repair the startup disk (not just permissions), as described here:
    The Repair functions of Disk Utility: what's it all about?
    Go to Apple Menu > System Preferences > Network, choose Network Port Configurations from the Show popup menu, and make sure that the configuration used to connect to Internet appears at the top of the list. Leave checked (enabled) only the port configuration needed to connect to Internet and Built-in Ethernet (in that order if not the same), uncheck (disable) the rest of network port configurations, and see whether that helps — if it doesn’t, turn ON again the ones you want enabled.
    Finally, try launching Mail under the following conditions (you may need to force quit it first if it’s running) and post back with your observations:
    1. Holding the Shift (⇧) key down until the main window appears. This tells Mail to not select any mailboxes or load any messages upon start up.
    2. With no Internet connection.

  • Today, my iPad2 wouldn't delete mail.  Then the screen turned black.  I turned the iPad2 off then on.  Got black screen.  Tried backing up to iTunes.  Got the message "iTunes cannot connect to this iPhone because unknown error occurred (OxE8000065).  Help

    Today, my iPad2 wouldn't delete mail.  Then the screen turned black.  I turned the iPad2 off then on.  Got black screen.  Tried backing up to iTunes.  Got the message "iTunes cannot connect to this iPhone because unknown error occurred (OxE8000065).  Help, please.

    Did you try restarting it by holding down the hold and lock button at the same time until you get the apple logo?  If you already tried that then you should try putting it in DFU mode and doing a restore by following these instructions- http://www.iclarified.com/entry/index.php?enid=1034

  • Recover deleted mails

    Hi all,
    I have problems to recover deleted mails on OCS. I have my DB on archive mode, I configure OCS to use Flashback Mail recovery, now i configure to use LogMiner to recover emails.
    The results is, now i can recover deleted mails from outlook, but not from the email Administrator page. When i tried it, I can see the deleted mails, i can selected the emails to recover, but when i click on the recover button, the program try to recover and display next message: "Error, None of the e-mails were recovered"
    Could somebody help me?
    Thanks in advance,
    Nacho

    just start TM from mail, scroll back in time in the mail window, locate the email in question and hit "restore". it will be restored to a separate mailbox in "on my mac" section. you can move it to the desired location from there.

  • Delete mail from server after removed from IN BOX

    I have a mail management issue I have not been able to fully solve.
    I am balancing the same POP email accounts among the laptop using Mail (for home use) and my desktop using Eudora Pro (for work). Using Eudora, I can manually select to delete a message from the server. Eudora's manual deletions are flawless. Using Mail, the only option I can see that will help me do this is to select delete mail "When moved from In Box." If I hit the "delete" key, wouldn't that be the same as "moving if from the IN BOX?" When is the protocol actually carried out? On the next mail check? Immediately? Upon quitting and restarting Mail? I'm confused as to how this happens and why it does not seem to work all of the time.
    Any and all assistance is most appreciated.
    Much obliged,
    Mick

    Yes, deleting a message counts as moving it out of
    the inbox. The commands to remove the message from
    the server are sent the next time you check mail from
    that server, but only if there are new messages to be
    received from the server. Yes, many of us feel that
    is a bug in Mail, that it should send the remove from
    server commands the next time you check mail, whether
    or not there are new messages to be downloaded.
    Oh Gawd, I bet that's it. Yes, if that is the case, I would agree. It does not lead to efficient mail management if there needs to be a new message there. Do you know of any plans to change or alter that? Or has someone written an AppleScript of some kind to execute the command regardless?
    It's a great command, otherwise. It's nice to be able to delete a message off of one computer and have it delete off of the server without any extra hassle.
    Just wondering if there are any workarounds out there other than sending oneself a new message to get the delete from server command to activate.
    cheers,
    Mick

  • Delete mail from server when removed from inbox

    I have a POP e-mail account set up. Under the mail account advanced settings there is an option to delete mail from the server when I delete it from the iPad inbox. I assume this is a valid option for the account since it is shown, and it is what I would like to do. However it doesn't appear to be working. Is this truly an available option?

    I also have a POO account wit ph Verizon and experienced the same thing. Apple tech said that is a property of POP accounts and I would have to change the account to Imap for the iPad to be able to delete from the server.

  • Delete mail from server using ipad not computer

    How do I delete mail from the server using my Ipad 

    That completely depends on your email service provider.
    For gmail, for example, you would do this as follows:
    Settings > Mail, Contacts, Calendars > [your gmail account] > Advanced > [Move Discarded Messages Into] Deleted Mailbox

  • Delete mail from server

    I use a pop3 account for mail. Can I set up the mail program to delete mail from server when I delete mail locally?

    Not precisely. You can set it to delete when when you move a message from the Inbox which should have the same effect in most cases, but I haven't tested it to make sure. 
    Mail -> Accounts -> Your POP account. Go to the Advanced pane and check the box that says "remove copy from server after retrieving a message" and make the appropriate setting in the pulldown.
    Regards.

  • Delete mail from server when deleting from mail

    I like Mail.
    But - the ONE feature I miss from Entourage is this:
    Delete mail from server when deleting the trash
    Mail can be set to delete messages from the server -- after downloading to the local computer. OK - BUT - I read my email from 3 computers. I want to keep the messages on the server - unless I delete them after trashing - and to read them on 3 computers.
    The BEST way is to delete when I trash them -- NOT when I read them.
    Using the mail program to see all messages on the server and to then delete them one-by-one is a major PITA.
    How can I tell Apple to add this feature?
    Dick
    Dual 2.7 G5, intel iMac, 3 G4 Macs, 2 iPods   Mac OS X (10.4.6)  

    Use the "When moved from Inbox" option that should do it. If you trash it then it goes, if you move it goes... HTH
    Siberian

  • Unable to delete mail from inbox. Message cannot move mail from inbox to trash.  How do I solve this.

    I am unable to delete mail from my inbox.  A window appears saying "message could not be moved to the mailbox trash.  How do I fix this.

    Give your phone a reboot - hold down power/home button together for 10 to 15 secs or until you see the apple logo and then release, wait for your phone to reboot and then try moving  your mail again.

  • How do I set up Apple Mail with Yahoo (IMAP) so I can delete mail on my iphone but leave it on the server and iMac.

    I am trying to maintain my inbox on my imac while not carrying around all my mail on my iphone.  As of now, I only seem to be able to sync the inboxes.  If I delete a mail on my iphone, it disappears on both the server and imac.  I only seem to be able to make it move the mail to the deleted mail box and keep it there.

    That's the way IMAP servers work. The messages really live on the server; the iPhone and the iMac just view them.

Maybe you are looking for

  • High bill with unusual calls and texts from non-functioning numbers?

    We have a family share plan with 3 phones, one phone for my husband and two phones for our employees.  Our usual phone bill runs around $150.  Our last bill was over $600, the majority charges being on one of our employee's lines.  This particular em

  • Creating java mappings

    Hi Experts, Is there any tool available for creating java mappings in XI given a source and target message. I have seen for XSLT mappings there is a tool called stylus studio, which has some kind of graphical tool to create the XSLT mapping between a

  • BPM Loop controlled by time

    I'm working in a scenario mapping n:1 message. In my case i need receive a number(100) of message until process mapping transformation will be executed. But i need too the loop that receive message and save in a multiline container break when one hou

  • 17" 2008 Macbook Pro to 15" 2011 Macbook Pro - Time Machine

    This might be a poor question, so forgive me. I was using a 17" Macbook Pro from 2008 and just bought a new 15" macbook. I transferred everything from Time Machine on its start-up. It feels as if everything is a bit choppier so my question is: is eve

  • Need information on the normal warrenty. help plaease.

    I bought my ipod during september last year. I didnt buy any warranty for it though. After using it for a couple months it started to do that green and orange light problem and it wont leave. my hp pavilion or itunes wont recognize it. i was going to