Skip to Main Content

Java EE (Java Enterprise Edition) General Discussion

Announcement

For appeals, questions and feedback about Oracle Forums, please email oracle-forums-moderators_us@oracle.com. Technical questions should be asked in the appropriate category. Thank you!

javax.mail.AuthenticationFailedException: Invalid login

843830Nov 8 2006 — edited Nov 13 2006
Hi,

I have a piece of code that works fine with imap but when I am using it for pop3 ,it doesn't work.

It gives the following exception.
javax.mail.AuthenticationFailedException: Invalid login
at com.sun.mail.pop3.POP3Store.protocolConnectPOP3Store.java:146)
at javax.mail.Service.connect(Service.java:275) at javax.mail.Service.connect(Service.java:156)
at mailDownload.MailReader.main(MailReader.java:30)

My Code :


package mailDownload;

import java.io.*;

import javax.mail.*;

public class MailReader
{
public static void main(String args[]) throws Exception
{
String host = "xxx.xxx.com";
String username = "xxxx";
String password = "xxxx";

// Get session
Session session = Session.getInstance(System.getProperties(), null);

// Get the store

Store store = session.getStore("pop3");
System.out.println("Connecting... ");
store.connect(host, username, password);

// Get folder
System.out.println("reading the Inbox.. ");
Folder folder = store.getFolder("INBOX");
folder.open(Folder.READ_ONLY);

...it continues...

Please help....
Thanks in advance..
Hari
Comments
Locked Post
New comments cannot be posted to this locked post.
Post Details
Locked on Dec 11 2006
Added on Nov 8 2006
7 comments
577 views