Results 1 to 2 of 2
  1. #1
    fhamumtaz is offline Member
    Join Date
    Feb 2017
    Posts
    3
    Rep Power
    0

    Default Java Mail to Read The Mail

    I'm getting this error when tried to read mail using JavaMail. Please let me know how to resolve this error :

    Part of my code :
    referhEmail();
    }

    private void referhEmail(){
    try {
    Properties props = new Properties();
    props.setProperty("mail.store.protocol", "pop3");
    props.setProperty("mail.pop3.port", "110");
    props.setProperty("mail.pop3.host", "localhost");


    Session session = Session.getInstance(props);
    final Store store = session.getStore("pop3");
    store.connect("localhost","xxxx@localhost", "xxx");

    And the error :

    javax.mail.AuthenticationFailedException: Username or password is invalid or incorrect.
    at com.sun.mail.pop3.POP3Store.protocolConnect(POP3St ore.java:213)
    at javax.mail.Service.connect(Service.java:366)
    at javax.mail.Service.connect(Service.java:246)
    at emailclientgamal.EmailClientGamal.referhEmail(Emai lClientGamal.java:462)
    at emailclientgamal.EmailClientGamal.connect(EmailCli entGamal.java:449)
    at emailclientgamal.EmailClientGamal.main(EmailClient Gamal.java:551)

  2. #2
    SurfMan's Avatar
    SurfMan is offline Godlike
    Join Date
    Nov 2012
    Location
    The Netherlands
    Posts
    1,851
    Rep Power
    6

    Default Re: Java Mail to Read The Mail

    My guess is that the username or password is invalid or incorrect. Solution: enter the right username and password.
    "It's not fixed until you stop calling the problem weird and you understand what was wrong." - gimbal2™ © 2013

Similar Threads

  1. Replies: 5
    Last Post: 03-21-2014, 02:03 PM
  2. trying to sendin mail with java mail api
    By akhilsrivastava in forum Advanced Java
    Replies: 1
    Last Post: 04-04-2012, 09:34 PM
  3. Replies: 2
    Last Post: 07-25-2009, 09:36 AM
  4. Replies: 2
    Last Post: 06-04-2009, 01:42 PM
  5. Replies: 2
    Last Post: 05-05-2008, 06:01 AM

Tags for this Thread

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •