我最近使用 Dovecot 和 Postfix 设置了一个全新的邮件服务器,该服务器可以使用/var/mail/
目录邮箱正确发送和接收邮件。
问题在于:无法通过 Roundcube 网络邮件界面查看邮件,但可以使用文件mutt
夹轻松访问邮件/var/mail
。
问题就出在这里,尽管其他一切正常,但 IMAP 并未显示用户收件箱中有任何内容。
IMAP 测试:
robo@some-server:~$ telnet localhost imap
Trying ::1...
Connected to localhost.
Escape character is '^]'.
* OK [CAPABILITY IMAP4rev1 LITERAL+ SASL-IR LOGIN-REFERRALS ID ENABLE IDLE STARTTLS AUTH=PLAIN AUTH=LOGIN] Dovecot (Ubuntu) ready.
a1 LOGIN robo yetanotherrandompasswordtofoolyou
a1 OK [CAPABILITY IMAP4rev1 LITERAL+ SASL-IR LOGIN-REFERRALS ID ENABLE IDLE SORT SORT=DISPLAY THREAD=REFERENCES THREAD=REFS THREAD=ORDEREDSUBJECT MULTIAPPEND URL-PARTIAL CATENATE UNSELECT CHILDREN NAMESPACE UIDPLUS LIST-EXTENDED I18NLEVEL=1 CONDSTORE QRESYNC ESEARCH ESORT SEARCHRES WITHIN CONTEXT=SEARCH LIST-STATUS SPECIAL-USE BINARY MOVE] Logged in
a2 LIST "" "*"
* LIST (\HasNoChildren \Sent) "." Sent
* LIST (\HasNoChildren) "." INBOX
a2 OK List completed.
a3 EXAMINE INBOX
* FLAGS (\Answered \Flagged \Deleted \Seen \Draft)
* OK [PERMANENTFLAGS ()] Read-only mailbox.
* 0 EXISTS
* 0 RECENT
* OK [UIDVALIDITY 1431224194] UIDs valid
* OK [UIDNEXT 1] Predicted next UID
* OK [NOMODSEQ] No permanent modsequences
a3 OK [READ-ONLY] Examine completed (0.000 secs).
a4 FETCH 1 BODY[]
a4 BAD Error in IMAP command FETCH: Invalid messageset
与此同时,其中恰好有一条/var/mail/robo
最近收到的消息。
答案1
发现问题:
Dovecot IMAP 尚未配置为使用mbox
邮件格式,只需在我的文件中添加以下行即可轻松更正/etc/dovecot/dovecot.conf
:
mail_location = mbox:~/mail:INBOX=/var/mail/%u
其中mail_location
之前并未指定。