javax.mail.AuthenticationFailedException: Invalid login
843830Nov 8 2006 — edited Nov 13 2006Hi,
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