无法使用电子邮件客户端设置 postfix/dovecot

无法使用电子邮件客户端设置 postfix/dovecot

在使用 outlook 和 thunderbird 等电子邮件客户端配置 postfix/dovecot 时遇到问题。

使用 telnet 和 openssl 我已经通过端口 587 和 993 测试了 smtp 和 imap。

已发送的邮件已在文件系统中接收。当我尝试通过 imap (openssl) 检索电子邮件时,我可以毫无问题地检索正文。

在 thunderbird 中,当我尝试设置帐户时,我无法通过“连接测试”。在 outlook 中,我通过了测试,并且帐户已设置。但收件箱中没有邮件。

账户设置:
IMAP - 993 - ssl/tls
SMTP - 587 - 启动 tls

Outlook 中的“连接测试”之后,/var/log/mail.log 包含以下内容:

Oct 16 10:09:45 mail dovecot: imap-login: Login: user=<[email protected]>, method=PLAIN, rip=40.101.90.197, lip=x, mpid=781860, TLS, session=>
Oct 16 10:09:45 mail dovecot: imap([email protected])<781860><RMgv9dUHdVAoZVrF>: Logged out in=63 out=999 deleted=0 expunged=0 trashed=0 hdr_count=0 hdr_b>
Oct 16 10:09:47 mail dovecot: imap-login: Login: user=<[email protected]>, method=PLAIN, rip=40.101.90.197, lip=x, mpid=781862, TLS, session=>
Oct 16 10:09:48 mail dovecot: imap([email protected])<781862><JZtY9dUHAhMoZVrF>: Logged out in=85 out=1084 deleted=0 expunged=0 trashed=0 hdr_count=0 hdr_>

Thunderbird 中的“连接测试”之后 /var/log/mail.log 包含以下内容:

Oct 16 10:01:52 mail dovecot: imap-login: Aborted login (no auth attempts in 0 secs): user=<>, rip=94.191.136.80, lip=themailserverip, TLS, session=<aa4d2dU>Oct 16 10:02:02 mail postfix/submission/smtpd[781321]: connect from 94.191.136.80.mobile.tre.se[94.191.136.80]
Oct 16 10:02:02 mail postfix/submission/smtpd[781321]: lost connection after CONNECT from 94.191.136.80.mobile.tre.se[94.191.136.80]
Oct 16 10:02:02 mail postfix/submission/smtpd[781321]: disconnect from 94.191.136.80.mobile.tre.se[94.191.136.80] commands=0/0

dovecot -n: (x.com 只是我真实域名的替代品)


# 2.3.13 (89f716dc2): /etc/dovecot/dovecot.conf
# Pigeonhole version 0.5.13 (cdd19fe3)
# OS: Linux 5.10.0-26-amd64 x86_64 Debian 11.8 ext4
# Hostname: mail.x.com
auth_mechanisms = plain login
mail_location = maildir:/home/vmail/%d/%n
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
}
passdb {
  args = /etc/dovecot/passwd
  driver = passwd-file
}
plugin {
  sieve = ~/.dovecot.sieve
  sieve_dir = ~/sieve
}
protocols = imap lmtp
service auth-worker {
  user = vmail
}
service auth {
  unix_listener /var/spool/postfix/private/auth {
    group = postfix
    mode = 0660
    user = postfix
  }
}
service imap-login {
  inet_listener imap {
    port = 143
  }
  inet_listener imaps {
    port = 993
    ssl = yes
  }
}
service lmtp {
  unix_listener /var/spool/postfix/private/dovecot-lmtp {
    group = postfix
    mode = 0600
    user = postfix
  }
}
service pop3-login {
  inet_listener pop3 {
    port = 110
  }
  inet_listener pop3s {
    port = 995
    ssl = yes
  }
}
ssl = required
ssl_cert = </etc/letsencrypt/live/x.com/cert.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
}
userdb {
  args = uid=vmail gid=vmail home=/home/vmail/%d/%n
  driver = static
}
protocol lmtp {
  mail_plugins = " sieve"
  postmaster_address = [email protected]
}
local_name mail.x.com {
  ssl_cert = </etc/letsencrypt/live/x.com/cert.pem
  ssl_key = # hidden, use -P to show it
}

后配置-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_size_limit = 0
mydestination = localhost
mynetworks = 127.0.0.0/8 [::ffff:127.0.0.0]/104 [::1]/128
myorigin = localhost
readme_directory = no
recipient_delimiter = +
relayhost =
smtpd_banner = $myhostname ESMTP $mail_name (Debian/GNU)
smtpd_recipient_restrictions = permit_sasl_authenticated, permit_mynetworks, reject_unauth_destination
smtpd_relay_restrictions = permit_mynetworks permit_sasl_authenticated defer_unauth_destination
smtpd_sasl_auth_enable = yes
smtpd_sasl_path = private/auth
smtpd_sasl_type = dovecot
smtpd_tls_auth_only = yes
smtpd_tls_cert_file = /etc/letsencrypt/live/x.com/cert.pem
smtpd_tls_key_file = /etc/letsencrypt/live/x.com/privkey.pem
smtpd_use_tls = yes
tls_server_sni_maps = hash:/etc/postfix/vmail_ssl.map
virtual_gid_maps = static:5000
virtual_mailbox_base = /home/vmail
virtual_mailbox_domains = x.com
virtual_mailbox_maps = hash:/etc/postfix/vmaps
virtual_minimum_uid = 100
virtual_uid_maps = static:5000

后配置-M

smtp       inet  n       -       y       -       -       smtpd
submission inet  n       -       y       -       -       smtpd -o syslog_name=postfix/submission -o smtpd_tls_security_level=encrypt -o smtpd_sasl_auth_enable=yes -o smtpd_client_restrictions=permit_sasl_authenticated,reject
pickup     unix  n       -       y       60      1       pickup
cleanup    unix  n       -       y       -       0       cleanup
qmgr       unix  n       -       n       300     1       qmgr
tlsmgr     unix  -       -       y       1000?   1       tlsmgr
rewrite    unix  -       -       y       -       -       trivial-rewrite
bounce     unix  -       -       y       -       0       bounce
defer      unix  -       -       y       -       0       bounce
trace      unix  -       -       y       -       0       bounce
verify     unix  -       -       y       -       1       verify
flush      unix  n       -       y       1000?   0       flush
proxymap   unix  -       -       n       -       -       proxymap
proxywrite unix  -       -       n       -       1       proxymap
smtp       unix  -       -       y       -       -       smtp
relay      unix  -       -       y       -       -       smtp -o syslog_name=postfix/$service_name
showq      unix  n       -       y       -       -       showq
error      unix  -       -       y       -       -       error
retry      unix  -       -       y       -       -       error
discard    unix  -       -       y       -       -       discard
local      unix  -       n       n       -       -       local
virtual    unix  -       n       n       -       -       virtual
lmtp       unix  -       -       y       -       -       lmtp
anvil      unix  -       -       y       -       1       anvil
scache     unix  -       -       y       -       1       scache
postlog    unix-dgram n  -       n       -       1       postlogd
maildrop   unix  -       n       n       -       -       pipe flags=DRXhu user=vmail argv=/usr/bin/maildrop -d ${recipient}
uucp       unix  -       n       n       -       -       pipe flags=Fqhu user=uucp argv=uux -r -n -z -a$sender - $nexthop!rmail ($recipient)
ifmail     unix  -       n       n       -       -       pipe flags=F user=ftn argv=/usr/lib/ifmail/ifmail -r $nexthop ($recipient)
bsmtp      unix  -       n       n       -       -       pipe flags=Fq. user=bsmtp argv=/usr/lib/bsmtp/bsmtp -t$nexthop -f$sender $recipient
scalemail-backend unix - n       n       -       2       pipe flags=R user=scalemail argv=/usr/lib/scalemail/bin/scalemail-store ${nexthop} ${user} ${extension}
mailman    unix  -       n       n       -       -       pipe flags=FRX user=list argv=/usr/lib/mailman/bin/postfix-to-mailman.py ${nexthop} ${user}

相关内容