Retreiving E-mails

Hi, I've recently been working with Java Mail and had a bit of a problem. I can send e-mails fine, but when i used the tutorials code to retrieve my e-mails it gets stuck at the connection even though I am using the same connection information to send as i am to retrieve. If anyone has any information as to why this would be i would greatly appreciate your time and effort. It freezes at the DEBUG POP3 when it tries to connect and I am not sure why.
    public MailClient() throws IOException{
    props = new Properties();
    System.out.println("Please enter username");
    BufferedReader in = new BufferedReader(new InputStreamReader(System.in));
    props.put("mail.smtp.user", in.readLine());
    System.out.println("Please enter password");
    props.put("mail.smtp.password", in.readLine());
    props.put("mail.smtp.host", "smtp.gmail.com");
    props.put("mail.smtp.port", "465");
    props.put("mail.smtp.starttls.enable","true");
    props.put("mail.smtp.auth", "true");
    props.put("mail.smtp.debug", "true");
    props.put("mail.smtp.socketFactory.port", "465");
    props.put("mail.smtp.socketFactory.class", "javax.net.ssl.SSLSocketFactory");
    props.put("mail.smtp.socketFactory.fallback", "false");
    public void checkMail() throws NoSuchProviderException, MessagingException{
auth = new SMTPAuthenticator();
// Get session
session = Session.getDefaultInstance(props, auth);
session.setDebug(true);
// Get the store
Store store = session.getStore("pop3");
store.connect("smtp.gmail.com", 465, props.getProperty("mail.smtp.user"),
        props.getProperty("mail.smtp.password"));
// 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(i + ": " + message.getFrom()[0]
+ "\t" + message[i].getSubject());
// Close connection
folder.close(false);
store.close();
private class SMTPAuthenticator extends javax.mail.Authenticator
@Override
public PasswordAuthentication getPasswordAuthentication()
return new PasswordAuthentication(props.getProperty("mail.smtp.user"), props.getProperty("mail.smtp.password"));
DEBUG: setDebug: JavaMail version 1.4.2
DEBUG: getProvider() returning javax.mail.Provider[STORE,pop3,com.sun.mail.pop3.POP3Store,Sun Microsystems, Inc]
DEBUG POP3: connecting to host "smtp.gmail.com", port 465, isSSL false

First of all, read the [JavaMail FAQ|http://java.sun.com/products/javamail/FAQ.html] and see how to significantly simplify your configuration and your code.
Then, read the debugging tips in the FAQ.
Most likely your firewall is blocking your access.

Similar Messages

  • Retreive Hotmail Mail in Outlook

    Hi,
    I am recently converted from Hotmail Live to Outlook by selecting option that I don't remember. There is only welcome mail in inbox..I want my previous live mails that I need back.Can anyone help me to retrieve or connect the outlook to live inbox so that
    I could get my Live emails back.I have tried allot to find an option or method to get the previous mails back but couldn't succeed.
    Thanks

    Hi,
    How did you upgrade Hotmail.com to Outlook.com? Please refer to the blog below to check if you did that in a proper way.
    http://blogs.office.com/2012/08/03/upgrade-from-hotmail-to-outlook-com/
    Since this forum is for general questions and feedback related to Outlook, better to post your questions to Outlook.com forum:
    http://answers.microsoft.com/en-us/outlook_com/forum/oemail?tab=Threads
    The reason why we recommend posting appropriately is you will get the most qualified pool of respondents, and
    other partners who read the forums regularly can either share their knowledge or learn from your interaction with us.
    Thank you for your understanding.
    Steve Fan
    TechNet Community Support

  • Mail does not retreive messages after upgrading to Mountain Lion

    I just upgraded my work iMac (2009) to Mountain Lion last night and now it will not retreive any messages from my work email account (POP).  It was working fine yesterday (and for the past 3+ years) while I was still on Lion, but despite searching for answers and trying multiple solutions for several hours, I still cannot get it to work.  Among other things, I have deleted and then added the account back (multiple times); restarted the Mac (multiple times); and zapped the PRAM, but nothing has fixed it yet. 
    When I select "Get Mail" from that mailbox and watch the Activity Monitor, it connects to the server, says "Fetching new mail", then "Preparing to retreive new mail", but it then just disappears after about about a minute and makes the "no mail" beep.  There are no error messages, but I can see in the bottom "Mail Activity" window that it says it's downloading 40+ messages but nothing shows up.  The mail account still works on my iPhone and I can check the mail on my webmail server, so I don't think it has anything to do with the server especially since it worked fine yesterday. 
    Any insight would be much appreciated because it's driving me crazy!!

    I forgot to mention (and add a new level of strangeness) that Mail is retreiving all of my messages from my personal (AT&T) account without issue.
    And I just discovered an even bigger problem: all of my emails from my Sent and other folders from my work account are completely gone!
    I may have no choice but to revert to my Lion system as of yesteday, before I installed ML.

  • Can I use JavaMail without Mailing Server??

    Dear All,
    My name is Jonathan Wong, a final year student.
    I am going to develop an internet application for my final year project that contains a part to sent e-mails by using JavaMail.
    Can I use JavaMail without setting up any Mail Server?? If no, can I use the ISP one?? Also, how can I retreive the mailing list from database to JavaMail?? Please advise.
    Thanks in advance.
    Best Wishes
    Jonathan

    You dont neend to set up a Mail server , You just have to connect to the desired mail server to send and retreive mails............. You should read the Javamail Api , you will find all the classes and required methods there ,, to retreive and send emails........

  • .mac trash in mail

    When I trash an email in goes into my .mac trash box, in the Mail program. Now I also show a trash bin called "on my mac" but trashed email never goes into it.
    I want to be able to keep deleted emails on my .mac account but erased from my Mail program and not retreivable from Mail.

    By default, a .Mac account is using IMAP. This protocol keeps all information and messages server side, and just "displays" the server content on the client (your Mac). So, if you delete a message on your client, you do delete it on the server.
    The only way, to leave deleted mails on the server but delete them on the client is to use POP3 instead of IMAP.
    http://docs.info.apple.com/article.html?artnum=51729
    http://docs.info.apple.com/article.html?artnum=25275

  • IE 10 stopped retreiving verizon mailbox

    After logging into my verizon account.....and trying to retreive my mail using IE 10.....no part of my email will show up.  I get the top of the verizon screen....and the very bottom of the page......but nothing else.
    Tech support has told me it's MY issue with IE10......funny it's been working fine.....now it won't work.  By starting Google Chrome.....it will show up.  Google chrome is something the wife put on here at some point
    IE will bring up any part of verizons web pages.......just not my mail box. 
    Can I use Chrome........yes.....but I want to know why I can't use IE 10 when it's been working.  Am I being "herded" into using certain programs/apps or is there a real reason IE won't retreive/display my email box???

    I recall a similar problem with IE10, but not as severe as what you described.  The solution was to run IE10 in compatibility mode.  IE11 also has to be run in compatibility mode for Verizon mail to display properly.
    Since it did work, and now doesn't, it would seem that something changed in your IE10.  Try deleting all cache, cookies, history, etc. Then verify it is running in compatibility mode.

  • No incoming mail...

    Hey guys.
    I just received my iBook after having sent it to apple for a DVD drive repair.
    When I first opened my Mail program, I was expecting it to load a weeks' worth of mail that had piled up, but to my surprise, no new mail will load since the day that I shipped the lap top out for repair.
    And there has certainly been mail sent to me. I have been checking it on my work computer on the web while my computer has been out for repair.
    The "retreiving mail" wheels spin next to each account name every time I click "Get Mail", but they eventually stop spinning without retreiving any mail. In any account.
    But, I can send mail. I just won't see the new mail, unless I check it on the web.
    I just recently had a problem with the Mail program giving me a "can't find server" prompt, but as I expected, it corrected itself because I hadn't changed any settings, and I had been using this program the same way for several years and it always worked fine (...except for some common mac issues).
    I don't think that this is a related problem, and this time I'm not sure what the problem is.
    And I didn't change any settings before I shipped it out for repair.
    Everything seems correct in the Mail preferences.
    Any ideas?
    Thank you!

    thanx for the points, even tho' I don't deserve 'em here, but I'll consider it as offsetting another post in another forum where the OP marked the thread as answered, replied "thanks a lot for all your help", and then didn't award points to the solution post

  • Can you retreive emails that have been deleted

    Can you retreive emails that have been deleted??

    Some phones use a "Trash Folder" system so you can retreive deleted emails within a certain window of time.  I am not sure on the Bionic.
    Also you could possibly retreive your mail directly from your email providers server. Example I use charter email, so I would contact charter communications, gmail is Google so you would contact Google, etc.
    Good luck.

  • Mail, .Mac, & Treo 700p

    I would like to use Mac Mail in OS 10.4.7 and my new Treo 700P to read email from a .Mac email account.
    My question is:
    What are the correct folder names to use for all three devices so that they will all remain synced properly using an IMAP setup?
    ie: when I send an email from my treo, I would like it to appear in the "sent" folder on my Mac and vice versa of course.
    Also, is there a way to schedule syncing of the IMAP folders on Mac Mail, to sync every 5 or 10 minutes?
    Any help would be greatly appreciated...
    Thank you,
    Mike Mills
    G5   Mac OS X (10.4.7)  

    The email client on your Mac and the email client on the Treo are independent. The Treo email client communicates with your email accounts at Comcast, not with your Mac. Likewise, your Mac retreives the mail from the Comcast server, not from your Treo. So, yes, the email issues are ISP-related, not Mac.
    Don't expect any real support from Palm, or Sprint, regarding Mac issues.
    Now to your specific questions.
    1) You don't say if you are using POP or IMAP with your comcast account. If you are using IMAP, it's very easy to keep the mail synced on both devices. IMAP is designed to ease reading/sending mail from multiple locations. If you are using POP, I would suggest you set the email client on the Treo to NOT delete mail on the server, then when you return home, you can download the mail to your Mac and delete it from the server if you desire.
    2) Simple. Enter your account info and not your wife's on the Treo.
    3) Syncing. If you want to fully sync yoru calendar and address book data, I suggest you skip iSync and use Missing Sync from www.markspace.com

  • Thunderbird retrieves old mail but not new

    hi
    i recently had to format my hdd and backed up my whole mail folder on other partition...
    when i installed TB i simply replaced the existing new folder with the one i previously backed up...
    when i started TB it showed all the folder as previous, but at the same time it startetd to retreive old mail as it was new (some 10.000+ mails). When it finally finished I deleted all the mail from the inbox (painfully slow process btw) it got stuck on tha last mail I received before I did the back up...
    now I can send email (although still slow) but I cannot receive any new mail...
    my account is set up well
    any suggestions??
    tnx

    Very big data files eventually become slow and develop issues. my suggestion is backup this files and remove emails you do not need for now. this will lighten up the application and allow you to receive more emails

  • Why can Netscape receive my mail, but mail appl. can't.

    I know there have been many issues with mail lately, & I am having the same problems. Can send but can't receive. However, when I open my Netscape browser & click the mail icon, it retrieves my mail from the ISP. How is Netscape able to get it when mail can't??

    Comcast is my host ISP, but am retreiving other mail
    from a local ISP(small town phone co. rtcol.com).
    Last week mail was not receiving from either ISP's,
    however, since the week-end, I am receiving from
    Comcast, but not the local ISP.
    A number of people reported problems receiving mail from Yahoo, including me. It seems to be working fine today. I believe I read about a new virus that started going around late last week around the time people started complaining. It could be that your ISPs are still dealing with the problem and haven't fixed the problem yet.
    Jim

  • Mail on two computer

    Can I put my Mac mail account on two computers and have the mail delivered to both computers. On my PC I use Outlook Express and set it to leave mail on the server so each computer can retreive the mail. It seems that on my Mac account which ever computer pick up the mail 1st take it off the server so the other computer can get it.

    You can set this in the Advanced pane of the account preferences.

  • Nokia Mail Problem N97

    I'm using NM v1.1 on my N97, IMAP account.
    The problem is that not all the messages appear in my Inbox, maybe a max of 5 per day out of 35.
    What should i do? 

    Are you using the inbuilt message cliet or the G-Mail application?
    I'm too running V20 my handset connects to the mail box, checks for new mail, then disconnects. I am using the inbuilt message client. If i go into messages an connect manually to retreive  my mail, when exiting it advises that my mail box will be disconnected and asks if i want to continue.
    Hope this helps

  • Mail stuck - Cant download mail for one use

    My mail server running 10.4.8 was running fine, until yesterday I cant download mail for one user. I know there's mail in the account verified by the usage in Server Admin.
    Using Mail a second account I have still works fine, but one of them wont retreive my mail. For that one account Mail has a spinning wheel for half a minute at least whereas the working account stays on for half a second. Both accounts are POP only.
    I've tried Reconstruct on that account via Server Admin. I've also installed mailbrf and ran -m on that account and -f on the database. I've also restarted my machine. No change.
    I've turned on POP logging to debug, and the log is identical for the working and non-working account.
    Any suggestions?

    MY GAWD! I just got all my mail! lol. Here's what changed....
    Nothing at all was changed with the server.
    However I recently got a new wireless router and swapped them, and after that all my mail came through. I dont understand this.
    Before cloning the router to get it to work, I plugged my new wireless router to my ISP and I was assigned a new IP, so that was one change. Another change is the brand of the router and possibly the settings, however I think I set it up identically (ie. same WAN/LAN IP, same ports forwarded, server still has the same static IP.
    Both mydomain.com and mail.mydomain.com point to my server via my router, and even though I check my mail from within the LAN side, I connect to mail.mydomain.com so it connects outside my network. And nothing changed with my domain settings other than me changing the IP address for both my domain and subdomain.
    So in summary the changes are:
    1. New wireless router (but same configuration for the most part)
    2. New IP address
    I still dont understand why I was unable to retrieve my mail before. I'm going to leave his question as 'unresolved' to see if I can understand what happened so I know for the future.
    Thanks for all your earlier suggestions and I look forward to figuring out what the problem was.

  • Ovi email error. DESPERATE!

    Hi guys,
      I'm Aaron and I'm having a very annoying problem with  my email. For some strange reason I can log on to my account however I cannot seem to view my email. The loading symbol just keeps going on and on, this applies for my inbox and all my folders.. It's very irritating cause its been going on for 5 days now. can someone please help me. 
    Thanks and regards,
    Aaron Picardo.
    Edited: (removed Email address)
    MODERATOR NOTE:
    Please be informed that personal/contact information are not allowed to be posted in this forum due to privacy and security reasons. Thank you for understanding.
    Kind regards,
    coffee_jelly23

    Thank you for feedback, we have found following issue on OVI Mail;  
    Note! I edited my earlier answer, because of find better workaround.
    This seems to occur primarily in India. R&D is working on the problem and a fix is expected shortly.  In the meantime, you can view and retreive your mails using the following procedure:
    1. Open a web browser and go to ovi.com http://ovi.com.
    2. Sign in with OVI Mail credentials to OVI account.(Do not select mail)  
    3. Select "account" (upper right portion of the screen)
    4. At the bottom of the "Basic Information" box, select "Edit Basic Information"
    5. Change the Country/Region to any country other than India, for example United Kingdom. (whose primary language is one you understand) and "Save."
    6. Go to http://mail.ovi.com and log in - your mailbox folders will be displayed. 

Maybe you are looking for