Postfix MySQL Dovecot Roundcube 配置

Postfix MySQL Dovecot Roundcube 配置

我正在设置邮件服务器,希望得到一些帮助。它从 Roundcube webmail 开始,当我尝试使用现有的正确用户名和密码登录时,它显示“登录失败”,因此我检查了错误日志,/var/log/mail.log发现有一个错误说

dovecot: auth-worker(10370): Error: sql([email protected],127.0.0.1): Password query 
failed: You have an error in your SQL syntax; check the manual that corresponds
to your MySQL server version for the right syntax to 
use near ''maildir:/var/vmail/...' as userdb_mail, 150 as userd' at line 1

当我检查密码查询时/etc/dovecot/dovecot-sql.conf.ext

password_query = \
  SELECT username as user, password, '/var/vmail/%d/%n' as userdb_home, \
  'maildir:/var/vmail/%d/%n' as userdb_mail, 150 as userdb_uid, 8 as userdb_gid \
  FROM mailbox WHERE username = '%u' AND active = '1'

哪一个看起来是对的?

有人有想法吗?

答案1

使用 SQL 查询更改您的配置文件,如下所示:

. . . . .
password_query= SELECT username as user, \
                       password \
                  FROM mailbox \
                 WHERE username = '%n@%d' \
                   AND active=1

user_query = SELECT maildir AS userdb_home, \
                        150 AS userdb_uid, \
                          8 AS userdb_gid, \
               FROM mailbox \
              WHERE username = '%n@%d' \
                AND active=1

iterate_query = SELECT username AS user FROM mailbox
. . . . .

请记住,反斜杠后不允许出现除 [ENTER] 之外的任何字符。

将下一个块添加config.local.phppostfixadmin

. . . . .
$CONF['maildir_name_hook'] = 'mdname';
function mdname ($domain, $user) {
    $part=explode("@", strtolower($user) );
    return sprintf("/var/vmail/%s/%s/", $part[1], $part[0]);
}
. . . . .

相关内容