线程"main"中的异常javax.mail.MessagingException:文件夹未使用SocketChannels [英] Exception in thread "main" javax.mail.MessagingException: Folder is not using SocketChannels

查看:208
本文介绍了线程"main"中的异常javax.mail.MessagingException:文件夹未使用SocketChannels的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

使用空闲管理器,将出现以下异常: 线程主" javax.mail.MessagingException中的异常:文件夹未使用SocketChannels

Using idle manager this exception appears: Exception in thread "main" javax.mail.MessagingException: Folder is not using SocketChannels

我该如何解决这个问题?

How can i solve this problem ?

ExecutorService es = Executors.newCachedThreadPool();
final IdleManager idleManager = new IdleManager(session, es);


folder.open(Folder.READ_WRITE);
            folder.addMessageCountListener(new MessageCountAdapter() {
                public void messagesAdded(MessageCountEvent ev) {
             Folder folder = (Folder)ev.getSource();
             Message[] msgs = ev.getMessages();
             System.out.println("Folder: " + folder +
                 " got " + msgs.length + " new messages");
                    try {
                        // process new messages
                        System.out.println("***********************process new messages : ");

                        idleManager.watch(folder); // keep watching for new messages
                    } catch (IOException | MessagingException ex) {
                        Logger.getLogger(mail2.class.getName()).log(Level.SEVERE, null, ex);
                    }
                }
            });

            idleManager.watch(folder); 

推荐答案

作为

..在会话中设置mail.imap.usesocketchannels属性

.. set the mail.imap.usesocketchannels property in the Session

这篇关于线程"main"中的异常javax.mail.MessagingException:文件夹未使用SocketChannels的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
相关文章
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆