无法使用 gmail 作为电子邮件客户端登录 dovecot

无法使用 gmail 作为电子邮件客户端登录 dovecot

我已经使用过这个安装 使用 Postfix Dovecot 配置电子邮件服务器

当我尝试使用 Gmail 作为电子邮件客户端(通过端口 993 连接到我的服务器)时,出现此错误

Unable to establish secure SSL connection to email.example.com

我的dovecot -n输出

auth_mechanisms = plain login
mail_location = maildir:/var/mail/vhosts/%d/%n
mail_privileged_group = mail

passdb {
  args = /etc/dovecot/dovecot-sql.conf.ext
  driver = sql
}
protocols = imap lmtp
service auth-worker {
  user = vmail
}
service auth {
  unix_listener /var/spool/postfix/private/auth {
    group = postfix
    mode = 0666
    user = postfix
  }
  unix_listener auth-userdb {
    mode = 0600
    user = vmail
  }
  user = dovecot
}
service imap-login {
  inet_listener imap {
    port = 0
  }
}
service lmtp {
  unix_listener /var/spool/postfix/private/dovecot-lmtp {
    group = postfix
    mode = 0600
    user = postfix
  }
}
ssl = required
ssl_cert = </etc/ssl/certs/dovecot.pem
ssl_key = </etc/ssl/private/dovecot.pem
userdb {
  args = uid=vmail gid=vmail home=/var/mail/vhosts/%d/%n
  driver = static
}

当我检查日志时,我看到了这个

 dovecot: imap-login: Disconnected (no auth attempts in 25 secs) ....

PS:该证书是自签名的。

答案1

根据@HBruijn的评论,Gmail 仅支持通过 POP3 检索电子邮件,而不支持 IMAP。这已在他们的产品论坛

Gmail 和 Dovecot 都支持通过 SSL 的 POP3,您可以通过在防火墙上打开端口 995 并将 Gmail 指向该端口来使用该功能。

答案2

在 Gmail 上使用带 SSL 的 pop3 来获取邮件

对于客户端:

  1. 输入 fqdn
  2. 输入您的完整电子邮件地址
  3. 选择端口 995
  4. 选择使用 SSL

对于服务器端:

SSL 证书必须:

  • 匹配服务器的域名 (FQDN)
  • 在你的情况下,email.example.com 而不是 example.com
  • 有效
  • 非自签名

将其放入 dovecot 配置中并查看日志我敢打赌这是证书问题

# Log unsuccessful authentication attempts and the reasons why they failed.
auth_verbose = yes

# In case of password mismatches, log the attempted password. Valid values  are
# no, plain and sha1. sha1 can be useful for detecting brute force password
# attempts vs. user simply trying the same password over and over again.
auth_verbose_passwords = yes

# Even more verbose logging for debugging purposes. Shows for example SQL
# queries.
auth_debug = yes

# In case of password mismatches, log the passwords and used scheme so the
# problem can be debugged. Enabling this also enables auth_debug.
auth_debug_passwords = yes

# Enable mail process debugging. This can help you figure out why Dovecot
# isn't finding your mails.
mail_debug = yes

# Show protocol level SSL errors.
verbose_ssl = yes

@downvoter:想解释一下你的投票吗?

相关内容