Welcome to the Java Programming Forums


The professional, friendly Java community. 21,500 members and growing!


The Java Programming Forums are a community of Java programmers from all around the World. Our members have a wide range of skills and they all have one thing in common: A passion to learn and code Java. We invite beginner Java programmers right through to Java professionals to post here and share your knowledge. Become a part of the community, help others, expand your knowledge of Java and enjoy talking with like minded people. Registration is quick and best of all free. We look forward to meeting you.


>> REGISTER NOW TO START POSTING


Members have full access to the forums. Advertisements are removed for registered users.

Results 1 to 6 of 6

Thread: pop3 in java, need a bug clearance

  1. #1
    Junior Member
    Join Date
    Sep 2009
    Posts
    22
    Thanks
    1
    Thanked 0 Times in 0 Posts

    Question pop3 in java, need a bug clearance

    HTML Code:
    import javax.mail.*;
    import javax.mail.internet.*;
    import java.util.*;
    import java.io.*;
    class mailx
    {
    public static void main(String args[])throws Exception
    {
    Properties myprop=new Properties();
    try
    {
    
    Session mailConnection = Session.getInstance(new Properties(), null);
    Store mystore=mailConnection.getStore("pop3s");
    mystore.connect("pop3.gmail.com","hgfdsa","asdfgh");
    Folder inbox=mystore.getFolder("INBOX");
     if(inbox==null)
     {
     System.out.println("Not avail");
     System.exit(1);
     }
     inbox.open(Folder.READ_ONLY);
    Message[] msg=inbox.getMessages();
    for(int i=0;i<msg.length;i++)
    {
    System.out.println("Msg"+(i+1));
    msg[i].writeTo(System.out);
    }
    inbox.close(false);
    mystore.close();
    }
    catch(Exception ex)
    {
    System.out.println(e.getMessage());
    }
    }
    }
    when i execute this code i got an error "Error:connection lost". where is the bug. pls somebody help me
    Last edited by ttsdinesh; September 24th, 2009 at 07:37 PM. Reason: spelling mistake and wrong input data


  2. #2
    Senile Half-Wit Freaky Chris's Avatar
    Join Date
    Mar 2009
    Posts
    834
    My Mood
    Cynical
    Thanks
    7
    Thanked 105 Times in 90 Posts

    Default Re: pop3 in java, need a bug clearance

    Have you enabled pop3 connections to your gmail account, and also shouldnt it be "pop.gmail.com" not pop3.gmail.com

  3. The Following User Says Thank You to Freaky Chris For This Useful Post:

    ttsdinesh (September 24th, 2009)

  4. #3
    Junior Member
    Join Date
    Sep 2009
    Posts
    22
    Thanks
    1
    Thanked 0 Times in 0 Posts

    Default Re: pop3 in java, need a bug clearance

    ok. let me try ur trick. thank you.

  5. #4
    Junior Member
    Join Date
    Sep 2009
    Posts
    22
    Thanks
    1
    Thanked 0 Times in 0 Posts

    Default Re: pop3 in java, need a bug clearance

    its working pal....!!!! thanks a lot.

  6. #5
    Senile Half-Wit Freaky Chris's Avatar
    Join Date
    Mar 2009
    Posts
    834
    My Mood
    Cynical
    Thanks
    7
    Thanked 105 Times in 90 Posts

    Default Re: pop3 in java, need a bug clearance

    Your welcome, if you could mark it as solved that would be great!

    Regards,
    Chris

  7. #6
    Junior Member
    Join Date
    Sep 2009
    Posts
    22
    Thanks
    1
    Thanked 0 Times in 0 Posts

    Default Re: pop3 in java, need a bug clearance

    sorry pal, as i am new to this forum, i am not able to mark it "answered". i am trying......

Tags for this Thread