当前位置: 代码迷 >> Java Web开发 >> 写的一个收邮件代码中出现了(pop3)~authorization failed解决思路
  详细解决方案

写的一个收邮件代码中出现了(pop3)~authorization failed解决思路

热度:387   发布时间:2016-04-17 13:40:39.0
写的一个收邮件代码中出现了(pop3)~~~authorization failed
public   ReceiveMail(JFrame   jFreame)
{
this.jFrame=jFrame;
}

public   void   receive(String   server,String   user,String   psd)
{
Store   store=null;
Folder   folder=null;

try
{
Properties   properties=System.getProperties();
Session   session=Session.getDefaultInstance(properties,null);
store=session.getStore( "pop3 ");
store.connect(server,   user,   psd);
folder=store.getDefaultFolder();
if(folder==null)
throw   new   Exception( "No   default   folder ");
folder=folder.getFolder( "INBOX ");
if(folder==null)
throw   new   Exception( "No   pop3   InBox ");
folder.open(Folder.READ_ONLY);
Message[]   msgs=folder.getMessages();
}
catch(Exception   e)
{
if   (dialog   ==   null)
                                dialog   =   new   AboutDialog(jFrame,e.getMessage());      
                          dialog.setVisible(true);
                          e.printStackTrace();
}
}

~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~上面是我的代码
javax.mail.AuthenticationFailedException:   ??·¨????????????/?????????í?ó????·????????ì?é??·?????   -   authorization   failed
at   com.sun.mail.pop3.POP3Store.protocolConnect
这个是异常~~
问题在什么地方啊?

------解决方案--------------------
你换成163的邮箱试下,看着没什么问题啊,在store.connect(server, user, psd);上下打印一下看看
  相关解决方案