我一直试图配置 Postfix 和 Dovecot,以便我可以通过我的域名从 Gmail 发送邮件,据我所知,Gmail 只是充当与我的服务器通信的常规 SMTP 客户端。
我已经跑了很多圈,但到了我的日志显示的地步warning: mail-qt1-f122.google.com[200.85.160.182]: SASL PLAIN authentication failed:
——没有关于失败性质的进一步解释,只有那条消息。
输出postconf -n
如下所示:
alias_database = hash:/etc/aliases
alias_maps = hash:/etc/aliases
append_dot_mydomain = no
biff = no
compatibility_level = 2
inet_interfaces = all
inet_protocols = all
mailbox_command = /usr/lib/dovecot/dovecot-lda -f "$SENDER" -a "$RECIPIENT"
mailbox_size_limit = 0
mydestination = $myhostname, localhost.localdomain, localhost, mydomain.com
myhostname = mydomain.com
mynetworks = 127.0.0.0/8 [::ffff:127.0.0.0]/104 [::1]/128
myorigin = mydomain.com
readme_directory = no
recipient_delimiter = +
smtp_sasl_type = dovecot
smtp_tls_session_cache_database = btree:${data_directory}/smtp_scache
smtpd_banner = $myhostname ESMTP $mail_name (Debian/GNU)
smtpd_relay_restrictions = permit_mynetworks permit_sasl_authenticated defer_unauth_destination
smtpd_sasl_auth_enable = yes
smtpd_sasl_path = private/auth
smtpd_sasl_security_options = noanonymous
smtpd_sasl_tls_security_options = $smtpd_sasl_security_options
smtpd_tls_CAfile = /etc/letsencrypt/live/mydomain.com/fullchain.pem
smtpd_tls_cert_file = /etc/letsencrypt/live/mydomain.com/cert.pem
smtpd_tls_key_file = /etc/letsencrypt/live/mydomain.com/privkey.pem
smtpd_tls_loglevel = 1
smtpd_tls_received_header = yes
smtpd_tls_session_cache_database = btree:${data_directory}/smtpd_scache
smtpd_use_tls = yes
tls_random_source = dev:/dev/urandom
virtual_transport = lmtp:unix:private/dovecot-lmtp
并doveconf -n
给我:
# 2.3.4.1 (f79e8e7e4): /etc/dovecot/dovecot.conf
# Pigeonhole version 0.5.4 ()
# OS: Linux 4.19.0-26-cloud-amd64 x86_64 Debian 10.13
# Hostname: vps758210
disable_plaintext_auth = no
mail_home = /home/vmail/%d/%n
mail_location = mbox:~/mail
mail_privileged_group = mail
namespace inbox {
inbox = yes
location =
mailbox Drafts {
special_use = \Drafts
}
mailbox Junk {
special_use = \Junk
}
mailbox Sent {
special_use = \Sent
}
mailbox "Sent Messages" {
special_use = \Sent
}
mailbox Trash {
special_use = \Trash
}
prefix =
}
passdb {
driver = pam
}
protocols = " imap pop3"
service auth {
unix_listener /var/spool/postfix/private/auth {
group = postfix
mode = 0666
user = postfix
}
}
service lmtp {
unix_listener lmtp {
group = postfix
mode = 0600
user = postfix
}
}
ssl_cert = </etc/dovecot/private/dovecot.pem
ssl_client_ca_dir = /etc/ssl/certs
ssl_dh = # hidden, use -P to show it
ssl_key = # hidden, use -P to show it
userdb {
driver = passwd
}
上述消息周围的日志如下所示:
Feb 1 13:29:34 vps758210 postfix/smtpd[20106]: connect from mail-qt1-f122.google.com[200.85.160.182]
Feb 1 13:29:34 vps758210 postfix/smtpd[20106]: Anonymous TLS connection established from mail-qt1-f122.google.com[200.85.160.182]: TLSv1.3 with cipher TLS_AES_128_GCM_SHA256 (128/128 bits) key-exchange X25519 server-signature ECDSA (P-256) server-digest SHA256
Feb 1 13:29:38 vps758210 postfix/smtpd[20106]: warning: mail-qt1-f122.google.com[200.85.160.182]: SASL PLAIN authentication failed:
Feb 1 13:29:38 vps758210 postfix/smtpd[20106]: lost connection after AUTH from mail-qt1-f122.google.com[200.85.160.182]
Feb 1 13:29:38 vps758210 postfix/smtpd[20106]: disconnect from mail-qt1-f122.google.com[200.85.160.182] ehlo=2 starttls=1 auth=0/1 commands=3/4
我发现很多问题看似相关,但很难找到消息没有是否提供了进一步的数据。此配置缺少什么?