javaMail獲取收件箱郵件之javax.mail.FolderNotFoundException
阿新 • • 發佈:2018-12-21
情況一:通過pop3獲取郵件
javax.mail.FolderNotFoundException: folder is not INBOX at com.sun.mail.pop3.POP3Folder.open(POP3Folder.java:205) at com.dascom.james.service.impl.MailServiceImpl.getFrom(MailServiceImpl.java:209) at com.dascom.james.controller.MailInfoController.receiveMail(MailInfoController.java:109) at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62) at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) at java.lang.reflect.Method.invoke(Method.java:498) ...
-
說明:通過檢視folder列表確實沒有找到Sent發件箱fullname;
-
檢視方式:Folder folder[ ]=store.getDefaultFolder().list();
-
解決辦法:可以換成使用IMAP獲取郵件
情況二:通過IMAP獲取郵件
javax.mail.FolderNotFoundException: Sent not found at com.sun.mail.imap.IMAPFolder.checkExists(IMAPFolder.java:383) at com.sun.mail.imap.IMAPFolder.open(IMAPFolder.java:934) at com.dascom.james.service.impl.MailServiceImpl.getFrom(MailServiceImpl.java:210) at com.dascom.james.controller.MailInfoController.receiveMail(MailInfoController.java:109) at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62) at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) at java.lang.reflect.Method.invoke(Method.java:498) ...
-
原因:使用者的發件箱為null;初始使用者只存在inbox收件箱,沒有發件箱、垃圾箱等,可以先發一封郵件試試