Dovecot 读取邮箱时出错:无法扩展邮件根目录的 ~/

Dovecot 读取邮箱时出错:无法扩展邮件根目录的 ~/

我想配置 dovecot 使用 mysql 作为用户数据库。这是我的配置:

# Authentication for SQL users. Included from 10-auth.conf.
#
# <doc/wiki/AuthDatabase.SQL.txt>

passdb {
  driver = sql

  # Path for SQL configuration file, see example-config/dovecot-sql.conf.ext
  args = /etc/dovecot/dovecot-sql.conf.ext
}

# "prefetch" user database means that the passdb already provided the
# needed information and there's no need to do a separate userdb lookup.
# <doc/wiki/UserDatabase.Prefetch.txt>
userdb {
  driver = prefetch
}

Dovecot 将 mail_gid 和 mail_uid 设置为邮件用户(exim 用户)。这是 sql 配置:

driver = mysql
connect = host=/var/run/mysqld/mysqld.sock dbname=system user=dovecot password=mypass
default_pass_scheme = PLAIN
password_query = SELECT password, '/var/mail/%d/%n' AS userdb_home FROM user WHERE username = '%n' AND domain = '%d'

这是成功登录后的错误:

dovecot: pop3-login: Login: user=<test@user>, method=PLAIN, rip=xxx, lip=xxx, mpid=24372, session=<dwTdGT8n0QBf9La9>
dovecot: pop3(test@user): Error: user test@user: Initialization failed: Namespace '': Home directory not set for user. Can't expand ~/ for mail root dir in: ~/mail:INBOX=/var/mail/domain/test@user
dovecot: pop3(test@user): Error: Invalid user settings. Refer to server log for more information.

我检查了 mysql 日志,发现一条正确的回复,其中包含密码和主页。这可能是什么?我可以将 dovecot 用户添加到邮件组吗?

答案1

有两个错误:

  • Exim 邮件格式与 dovecot 邮件格式不匹配,exim 正在使用邮件目录,dovecot 配置为。我必须将 dovecot 配置更改为 maildir。
  • Dovecot maildir 配置使用完整地址作为用户文件夹,而 exim 仅使用地址的用户部分来写入其用户文件夹。例如:/var/mail/mydomain.com/[电子邮件保护]代替/var/mail/mydomain.com/myuser

我必须更改 dovecot 中的此配置行来自:

mail_location = mbox:~/mail:INBOX=/var/mail/%d/%u

mail_location = maildir:/var/mail/%d/%n

(我将“maildir”前缀加下划线而不是“mbox”,并将 %n 占位符加下划线而不是 %u)

相关内容