Postfix 无法接收来自实际电子邮件的邮件但可以接收来自 sendmail 的邮件?

Postfix 无法接收来自实际电子邮件的邮件但可以接收来自 sendmail 的邮件?

好的,我正在尝试使用 postfix 将邮件从我的 ubuntu 服务器(我们称之为 example.com)转发到外部 gmail 帐户。

问题是当我使用另一个 gmail 和 yahoo 帐户发送邮件到[电子邮件保护],我检查了一下var/log/mail.info,什么也没有出现。

但是,当我sendmail在终端中使用并发送到同一个地址时,我会将以下内容写入日志以及实际发送并最终到达我的收件箱的邮件:

Jan  4 00:02:48 Machine postfix/local[6520]: 6C82DB80C4A: to=<[email protected]>, relay=local, delay=0.01, delays=0/0/0/0.01, dsn=2.0.0, status=sent (delivered to command: procmail -a "$EXTENSION")
Jan  4 00:02:48 Machine postfix/qmgr[6497]: 6C82DB80C4A: removed
Jan  4 00:09:58 Machine postfix/pickup[6496]: B206CB80C46: uid=0 from=<root>
Jan  4 00:09:58 Machine postfix/cleanup[6540]: B206CB80C46: message-id=<20140104050958.B206CB80C46@Machine>
Jan  4 00:09:58 Machine postfix/qmgr[6497]: B206CB80C46: from=<[email protected]>, size=265, nrcpt=1 (queue active)
Jan  4 00:09:59 nightMachine postfix/smtp[6542]: B206CB80C46: to=<[email protected]>, orig_to=<[email protected]>, relay=gmail-smtp-in.l.google.com[74.125.142.26]:25, delay=14, delays=13/0/0.22/0.69, dsn=2.0.0, status=sent (250 2.0.0 OK 1388812199 qd7si6471164igb.62 - gsmtp)
Jan  4 00:09:59 Machine postfix/qmgr[6497]: B206CB80C46: removed

这有什么原因吗?我该如何解决?

我关注教程。

后缀/虚拟:

[email protected] [email protected]

主文件:

# 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

# 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.

myhostname = Machine
alias_maps = hash:/etc/aliases
alias_database = hash:/etc/aliases
myorigin = /etc/mailname
mydestination = example.com, Machine, localhost.localdomain, localhost
relayhost = 
mynetworks = 127.0.0.0/8 [::ffff:127.0.0.0]/104 [::1]/128
mailbox_command = procmail -a "$EXTENSION"
mailbox_size_limit = 0
recipient_delimiter = +
inet_interfaces = all
home_mailbox = mail/


#added the following for mail server :O!!
virtual_alias_domains = example.com 
virtual_alias_maps = hash:/etc/postfix/virtual

当我dig example.com mx在终端中执行查询时的结果:

;; ANSWER SECTION:
example.com.        21600   IN      MX      10 mail.example.com.

telnet example.com 25

Connected to example.com.
Escape character is '^]'.
220 Machine ESMTP Postfix (Ubuntu)

答案1

您已将 MX 记录设置为“mail.example.com”。这意味着当任何邮件服务器尝试向您发送邮件时,它们将执行 DNS 查找以查找 mail.example.com。由于不存在该地址,因此发送系统不知道将电子邮件发送到何处。

要解决此问题,请执行以下两项操作之一:

  1. 彻底删除您的 MX 记录。只要您没有 MX 记录,发送系统就会对 example.com 进行 DNS 查找,并且由于该查找确实解析到运行您的邮件服务器的服务器,因此此方法可行。
  2. 除了 MX 记录之外,还要为 mail.example.com 创建 A 或 CNAME 记录。

它看起来应该像他的 A 记录:

mail     A     127.0.0.1

(当然,IP 地址应该是服务器的实际 IP,而不是环回地址)

对于 CNAME 来说如下:

mail     CNAME example.com.

相关内容