Postfix 无法接收邮件

Postfix 无法接收邮件
  1. 我有一台 VPS 服务器(ubuntu)
  2. 我有一个 Postfix 邮件服务器和 Dovecot IMAP/POP3 服务器
  3. 我已经配置了我的 postfix 服务器来发送邮件(我得到了 10/10 的发送分数)(DKIM 正确、DMARC 正确、SPF 正确、PTR 正确、MX 正确、A 记录)
  4. Postfix 配置文件中的 $mydestination 是:
mydestination = $myhostname, mskillsa.com, mainserver.mskillsa.com, localhost.mskillsa.com, localhost, mail.mskillsa.com
  1. 当我在终端中运行此命令(netstat -tnap | grep master)时,我得到:
tcp        0      0 0.0.0.0:465             0.0.0.0:*               LISTEN      11420/master
tcp        0      0 0.0.0.0:25              0.0.0.0:*               LISTEN      11420/master
tcp6       0      0 :::465                  :::*                    LISTEN      11420/master
tcp6       0      0 :::25                   :::*                    LISTEN      11420/master
  1. 当我运行(dig MX mskillsa.com)时,我得到:
; <<>> DiG 9.11.3-1ubuntu1.17-Ubuntu <<>> MX mskillsa.com
;; global options: +cmd
;; Got answer:
;; ->>HEADER<<- opcode: QUERY, status: NOERROR, id: 12484
;; flags: qr rd ra; QUERY: 1, ANSWER: 2, AUTHORITY: 0, ADDITIONAL: 1

;; OPT PSEUDOSECTION:
; EDNS: version: 0, flags:; udp: 512
;; QUESTION SECTION:
;mskillsa.com.                  IN      MX

;; ANSWER SECTION:
mskillsa.com.           14400   IN      MX      10 mainserver.mskillsa.com.
mskillsa.com.           14400   IN      MX      10 mail.mskillsa.com.

;; Query time: 125 msec
;; SERVER: 31.220.105.10#53(31.220.105.10)
;; WHEN: Fri Aug 12 11:42:49 UTC 2022
;; MSG SIZE  rcvd: 89

  1. 当我运行(dig A mskillsa.com)时,我得到:
; <<>> DiG 9.11.3-1ubuntu1.17-Ubuntu <<>> A mskillsa.com
;; global options: +cmd
;; Got answer:
;; ->>HEADER<<- opcode: QUERY, status: NOERROR, id: 53419
;; flags: qr rd ra; QUERY: 1, ANSWER: 1, AUTHORITY: 0, ADDITIONAL: 1

;; OPT PSEUDOSECTION:
; EDNS: version: 0, flags:; udp: 512
;; QUESTION SECTION:
;mskillsa.com.                  IN      A

;; ANSWER SECTION:
mskillsa.com.           14400   IN      A       (My IP address)

;; Query time: 25 msec
;; SERVER: 31.220.105.10#53(31.220.105.10)
;; WHEN: Fri Aug 12 11:44:23 UTC 2022
;; MSG SIZE  rcvd: 57
  1. 当我将邮件发送到我的服务器时,我也会收到来自 Gmail 的类似邮件(退回或拒绝),它显示:
This is the mail system at host mainserver.mskillsa.com.

I'm sorry to have to inform you that your message could not
be delivered to one or more recipients. It's attached below.

For further assistance, please send mail to postmaster.

If you do so, please include this problem report. You can
delete your own text from the attached returned message.

                   The mail system

<[email protected]>: unknown user: "info"
  1. 我有 usermin 界面(端口:20000)
  2. 我有 roundcube 接口
  3. 我有 virtualmin/webmin 管理器
  4. 我可以从他们那里发送到任何地址,但我无法接收
  5. 我的 mail.log 文件是空的
  6. 当我运行 (telnet 45.82.73.195 25) 时我得到
Trying 45.82.73.195...
Connected to 45.82.73.195.
Escape character is '^]'.
  1. 当我运行(telnet 45.82.73.195 465)时,我得到:
Trying 45.82.73.195...
Connected to 45.82.73.195.
Escape character is '^]'.

我的后缀配置:

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 = procmail -a "$EXTENSION"
mailbox_size_limit = 0
milter_default_action = accept
mydestination = $myhostname, mskillsa.com, mainserver.mskillsa.com, localhost.mskillsa.com, localhost, mail.mskillsa.commyhostname = mainserver.mskillsa.com
mynetworks = 127.0.0.0/8 [::ffff:127.0.0.0]/104 [::1]/128
myorigin = $myhostname
non_smtpd_milters = inet:localhost:8891
readme_directory = no
recipient_delimiter = +
smtp_tls_session_cache_database = btree:${data_directory}/smtp_scache
smtpd_banner = $myhostname ESMTP $mail_name (Ubuntu)
smtpd_milters = inet:localhost:8891
smtpd_relay_restrictions = permit_mynetworks permit_sasl_authenticated defer_unauth_destination
smtpd_sasl_path = private/auth
smtpd_sasl_type = dovecot
smtpd_tls_cert_file = /etc/ssl/certs/ssl-cert-snakeoil.pem
smtpd_tls_key_file = /etc/ssl/private/ssl-cert-snakeoil.key
smtpd_tls_session_cache_database = btree:${data_directory}/smtpd_scache
smtpd_use_tls = yes
virtual_gid_maps = static:2000
virtual_mailbox_base = /home/virtualmailboxes
virtual_mailbox_domains = mskillsa.com
virtual_mailbox_maps = hash:/etc/postfix/virtualmaps
virtual_minimum_uid = 500
virtual_uid_maps = static:2000

Dovecot 配置:

auth_mechanisms = plain login
disable_plaintext_auth = no
mail_location = maildir:~/Maildir
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"
ssl_cert = </etc/dovecot/private/dovecot.pem
ssl_client_ca_dir = /etc/ssl/certs
ssl_key =  # hidden, use -P to show it
userdb {
  driver = passwd
}

local_name mskillsa.com {
  ssl_cert = </home/mskillsa/ssl.combined
  ssl_key =  # hidden, use -P to show it
}
local_name *.mskillsa.com {
  ssl_cert = </home/mskillsa/ssl.combined
  ssl_key =  # hidden, use -P to show it
}

您能帮我解决从外部来源接收邮件的问题吗?

答案1

您的 Dovecot 配置为使用 Maildirs(即,用户的邮件info存储在目录中,并且该目录下有特殊的子目录结构)-配置中的/home/info/Maildir行。mail_location = maildir:~/Maildir

Postfix 默认配置为使用邮箱,即用户的邮件info存储在文件 /var/mail/info

我看到您尝试为虚拟用户配置 Postfix(virtual_...Postfix 配置中的所有参数),但这可能没有必要,因为您的 Dovecot 配置表明您有具有 Maildirs 的真实系统用户 - 真的有吗?或者您实际上有虚拟用户吗?

为了使您的 Postfix 配置与 Dovecot 配置一致,您必须删除virtual_...Postfix 中的所有行和以下内容main.cf

home_mailbox = Maildir/
mail_spool_directory = /home/

但是如果您使用虚拟用户并且virtual_...Postfix 配置中的所有参数都是正确的,那么您也需要为虚拟用户配置 Dovecot。

答案2

次要问题:

mskillsa.com.           14400   IN      MX      10 mainserver.mskillsa.com.
mskillsa.com.           14400   IN      MX      10 mail.mskillsa.com.

没有必要设置两个指向同一服务器/IP 地址的 MX 记录。删除一个(例如带有 mail.mskillsa.com 的 MX 记录)。


相关错误是:

<[email protected]>: unknown user: "info"

这表明您尚未设置任何邮箱。

该电子邮件地址需要(取决于您的设置)创建一个名为“info”的本地系统用户,或者映射到不同的邮箱(如果您愿意,可以使用电子邮件别名,例如电子邮件[电子邮件保护]在邮箱中投递mfahd)或者需要创建虚拟邮件用户。

相关内容