Postfix 问题:电子邮件未显示

Postfix 问题:电子邮件未显示

我正在学习使用 PostFix 来创建个人跨域邮件服务。

我被这个问题困扰了一段时间,但是……事情是这样的。在这种情况下,DNS 和邮件服务器以及目的地都位于同一位置。两台虚拟机通过本地网络连接,解析其 DIG/nslookup 名称。

如果我尝试发送到同一个域/机器

Feb 11 12:32:58 mx1 postfix/cleanup[3109]: A94C7C8BF9: message-id=<[email protected]>
Feb 11 12:32:58 mx1 postfix/qmgr[1176]: A94C7C8BF9: from=<test2@mx1>, size=346, nrcpt=1 (queue active)
Feb 11 12:32:58 mx1 postfix/local[3111]: A94C7C8BF9: to=<[email protected]>, relay=local, delay=0.2, delays=0.19/0.01/0/0.01, dsn=2.0.0, status=sent (delivered to mailbox)
Feb 11 12:32:58 mx1 postfix/qmgr[1176]: A94C7C8BF9: removed

已收到电子邮件,但 Maildir 上未显示任何内容

当我尝试发送到其他域时

Feb 11 12:33:32 mx1 postfix/pickup[1175]: 368FDC8BFC: uid=1001 from=<test2@mx1>
Feb 11 12:33:32 mx1 postfix/cleanup[3109]: 368FDC8BFC: message-id=<[email protected]>
Feb 11 12:33:32 mx1 postfix/qmgr[1176]: 368FDC8BFC: from=<test2@mx1>, size=334, nrcpt=1 (queue active)
Feb 11 12:33:32 mx1 postfix/local[3111]: 368FDC8BFC: to=<[email protected]>, relay=local, delay=0.13, delays=0.1/0/0/0.03, dsn=5.1.1, status=bounced (unknown user: "test")
Feb 11 12:33:32 mx1 postfix/cleanup[3109]: 4039EC8BFA: message-id=<[email protected]>
Feb 11 12:33:32 mx1 postfix/qmgr[1176]: 4039EC8BFA: from=<>, size=2204, nrcpt=1 (queue active)
Feb 11 12:33:32 mx1 postfix/bounce[3128]: 368FDC8BFC: sender non-delivery notification: 4039EC8BFA
Feb 11 12:33:32 mx1 postfix/qmgr[1176]: 368FDC8BFC: removed
Feb 11 12:33:32 mx1 postfix/smtpd[3131]: connect from localhost[127.0.0.1]
Feb 11 12:33:32 mx1 postfix/smtp[3130]: warning: host mx1[127.0.1.1]:25 greeted me with my own hostname mx1.mailantonio.com
Feb 11 12:33:32 mx1 postfix/smtp[3130]: warning: host mx1[127.0.1.1]:25 replied to HELO/EHLO with my own hostname mx1.mailantonio.com
Feb 11 12:33:32 mx1 postfix/smtp[3130]: 4039EC8BFA: to=<test2@mx1>, relay=mx1[127.0.1.1]:25, delay=0.04, delays=0.01/0.01/0.03/0, dsn=5.4.6, status=bounced (mail for mx1 loops back to myself)
Feb 11 12:33:32 mx1 postfix/qmgr[1176]: 4039EC8BFA: removed
Feb 11 12:33:32 mx1 postfix/smtpd[3131]: disconnect from localhost[127.0.0.1] ehlo=1 quit=1 commands=2

邮件无法发送,因为它被重定向到其自己的 FQDN?

它们都在同一个本地网络中。机器 Mx1 是 10.0.0.1-> mailantonio.com 域。机器 Mx2 是 10.0.0.2-> mailgarcia.com

这是 postfix 配置文件。老实说,我完全搞不懂,而且我已经找了好久才知道哪里出了问题…… MX1

# See /usr/share/postfix/main.cf.dist for a commented, more complete version


# Debian specific:  Specifying a file name will cause the first
# line of that file to be used as the name.  The Debian default
# is /etc/mailname.
#myorigin = /etc/mailname

smtpd_banner = $myhostname ESMTP $mail_name (Ubuntu)
biff = no

# appending .domain is the MUA's job.
append_dot_mydomain = no

# Uncomment the next line to generate "delayed mail" warnings
#delay_warning_time = 4h

readme_directory = no

# See http://www.postfix.org/COMPATIBILITY_README.html -- default to 2 on
# fresh installs.
compatibility_level = 2

# TLS parameters
smtpd_tls_cert_file=/etc/ssl/certs/ssl-cert-snakeoil.pem
smtpd_tls_key_file=/etc/ssl/private/ssl-cert-snakeoil.key
smtpd_use_tls=yes
smtpd_tls_session_cache_database = btree:${data_directory}/smtpd_scache
smtp_tls_session_cache_database = btree:${data_directory}/smtp_scache

# See /usr/share/doc/postfix/TLS_README.gz in the postfix-doc package for
# information on enabling SSL in the smtp client.

smtpd_relay_restrictions = permit_mynetworks permit_sasl_authenticated defer_unauth_destination
myhostname = mx1.mailantonio.com
alias_maps = hash:/etc/aliases
alias_database = hash:/etc/aliases
myorigin = /etc/mailname
mydestination = $myhostname, localhost.$mydomain, localhost $mydomain, mx2,mailgarcia.com, mailgarcia.com, mx2
relayhost = 
mynetworks = 10.0.0.0/24
mailbox_size_limit = 0
recipient_delimiter = 
default_transport = smtp
relay_transport = smtp
relay_domains =  mailgarcia.com
inet_interfaces = all
inet_protocols = ipv4

MX2

 See /usr/share/postfix/main.cf.dist for a commented, more complete version


# Debian specific:  Specifying a file name will cause the first
# line of that file to be used as the name.  The Debian default
# is /etc/mailname.
#myorigin = /etc/mailname

smtpd_banner = $myhostname ESMTP $mail_name (Ubuntu)
biff = no

# appending .domain is the MUA's job.
append_dot_mydomain = no

# Uncomment the next line to generate "delayed mail" warnings
#delay_warning_time = 4h

readme_directory = no

# See http://www.postfix.org/COMPATIBILITY_README.html -- default to 2 on
# fresh installs.
compatibility_level = 2

# TLS parameters
smtpd_tls_cert_file=/etc/ssl/certs/ssl-cert-snakeoil.pem
smtpd_tls_key_file=/etc/ssl/private/ssl-cert-snakeoil.key
smtpd_use_tls=yes
smtpd_tls_session_cache_database = btree:${data_directory}/smtpd_scache
smtp_tls_session_cache_database = btree:${data_directory}/smtp_scache

# See /usr/share/doc/postfix/TLS_README.gz in the postfix-doc package for
# information on enabling SSL in the smtp client.

smtpd_relay_restrictions = permit_mynetworks permit_sasl_authenticated defer_unauth_destination
myhostname = mx2.mailgarcia.com
alias_maps = hash:/etc/aliases
alias_database = hash:/etc/aliases
myorigin = $mydomain
mydestination = $myhostname, localhost.$mydomain, localhost, $mydomain, mx1.mailantonio.com, mailantonio.com, mx1 
relayhost = 
mynetworks = 10.0.0.0/24
mailbox_size_limit = 0
recipient_delimiter = 
default_transport = smtp
relay_transport = smtp
relay_domains = mailantonio.com
inet_interfaces = all
inet_protocols = ipv4
home_mailbox = Maildir/

创建了 Maildir 目录,其中包含每个用户的 cur、new 和 tmp... 我使用的是基于 Ubuntu 的 linux mint。据我所知,配置应该相同。安装了 Courier IMAP 和 POP。


回覆答覆。

MX1 配置

mydomain = mailantonio.com
myorigin = $mydomain
mydestination = $myhostname, mx1.$mydomain, $mydomain, mx2.mailgarcia.com, mailgarcia.com, mx2

MX2 配置

mydomain = mailgarcia.com
myorigin = $mydomain
mydestination = $myhostname, mx2.$mydomain, $mydomain, mx1.mailantonio.com, mailantonio.com, mx1 

现在可以将它发送给自身。但是,跨域仍然不确定。

日志后缀

Feb 11 16:03:51 mx1 postfix/smtp[3007]: 6AF41C8BC8: to=<test2@mx1>, relay=none, delay=0.03, delays=0/0.01/0.01/0, dsn=4.4.3, status=deferred (Host or domain name not found. Name service error for name=mx1 type=MX: Host not found, try again)

从机器 mx1.mailantonio.com 以 test3 身份发送邮件至[电子邮件保护],我是否必须删除配置上的自引用目的地?

答案1

您正在使用 mydestination = localhost.$mydomain 。这不好。请使用 mx2./mx1. 代替 localhost。

您发布的配置中没有 mydomain。这也可能有问题。您应该在两个配置中添加 mydomain = yournames.com。

如果 myhostname、mydomain 和 mydestination 不正确,则可能会出现环回问题。

相关内容