javax.mail.MessagingException: * BYE 发生内部错误

javax.mail.MessagingException: * BYE Internal error occurred

我正在尝试在 CentOS 7 开发机器上安装 JavaMail,仅使用 localhost 来接收电子邮件。为此,我安装了 dovecotpostfixmailx。我刚刚使用 the instructions in this tutorial 安装了 dovecot但是当我尝试阅读收件箱时,我的 JavaMail 测试代码一直给我各种身份验证错误。如何解决这些身份验证错误以便我可以登录?

起初,我收到与找不到证书相关的错误,但我能够通过在配置文件中注释掉任何提及的 ssl 来解决所有这些错误,方法是将协议更改为 imap 而不是 imaps,并通过将身份验证更改为 plain 而不是 login。 (我可以做所有这些事情,因为它是一台开发机器,我只想让 JavaMail 工作,然后再添加安全性。)但在所有这些更改之后,我仍然得到:

javax.mail.MessagingException: * BYE Internal error occurred.   
Refer to server log for more information.  

抛出错误的代码行是:

store.connect("localhost.localdomain", "root", "somepassword");

请注意,在 CentOS 终端中键入 hostname 会导致 localhost.localdomain

/var/log/maillog条记录是:

Jan  8 16:08:01 localhost dovecot: imap-login: Login: user=<root>, method=PLAIN, rip=127.0.0.1, lip=127.0.0.1, mpid=7965, secured, session=<yb8l8ywMdwB/AAAB>
Jan  8 16:08:01 localhost dovecot: imap: Error: user root: Invalid settings in userdb: userdb returned 0 as uid
Jan  8 16:08:01 localhost dovecot: imap: Error: Invalid user settings. Refer to server log for more information.

Dovecot 不允许您以 root 身份登录。使用其他用户和用户 ID。