这是我第一次设置电子邮件服务器,并使用 Dovecot 作为 IMAP 端。我一直在关注这教程。
当我尝试登录服务器时,以下内容被打印到错误日志中:
Apr 16 21:39:40 neonorb dovecot: imap([email protected]): Error: Relative home directory paths not supported: 0
Apr 16 21:39:40 neonorb dovecot: imap([email protected]): Error: Invalid user settings. Refer to server log for more information.
Apr 16 21:39:41 neonorb dovecot: imap([email protected]): Error: Relative home directory paths not supported: 0
Apr 16 21:39:41 neonorb dovecot: imap([email protected]): Error: Invalid user settings. Refer to server log for more information.
我查看了一下,这似乎是一个从未被支持的“功能”,它只是从未给出错误消息。
我查看了教程的评论,其他人也遇到了这个问题,他们建议删除该'/home/mailboxes/home/'||maildir as home,
部分,但这只导致了另一个错误:
Apr 16 21:45:36 neonorb dovecot: imap([email protected]): Error: User initialization failed: Initializing mail storage from mail_location setting failed: Ambiguous mail location setting, don't know what to do with it: 0 (try prefixing it with mbox: or maildir:)
Apr 16 21:45:36 neonorb dovecot: imap([email protected]): Error: Invalid user settings. Refer to server log for more information.
Apr 16 21:45:37 neonorb dovecot: imap([email protected]): Error: User initialization failed: Initializing mail storage from mail_location setting failed: Ambiguous mail location setting, don't know what to do with it: 0 (try prefixing it with mbox: or maildir:)
Apr 16 21:45:37 neonorb dovecot: imap([email protected]): Error: Invalid user settings. Refer to server log for more information.
我一直在摆弄配置文件,但没有任何进展。
答案1
看来 dovecot 正在查找邮件目录位置。但是它需要知道要使用哪种类型的投递。您的 maildir 条目应以 或其他受支持的类型作为前缀mbox:
。maildir
我更喜欢maildir:
。
或者重新添加邮箱位置:
mail_location = maildir:~/Maildir
或者使用用户名来设置位置,使用您喜欢的目录代替/home
:
mail_location = maildir:/home/%u/Maildir
答案2
我将这两行(来自 DO 教程)添加到我的/etc/dovecot/dovecot.conf
:
mail_home = /home/mailboxes/home/
mail_location = maildir:/home/mailboxes/maildir/
我还从 SQL 查询中删除了相同的内容/etc/dovecot/dovecot-sql.conf
。
现在它起作用了!
答案3
在/etc/dovecot/dovecot-sql.conf.ext
集合中user_query
:
user_query = SELECT CONCAT('/var/mail/virtual/',maildir) AS home, 5000 AS uid, 5000 AS gid FROM mailbox WHERE username = '%u'
/var/mail/virtual/
maildirs 的顶级目录在哪里。