Email 无法从外部邮件服务器(如gmail)发送到postfix服务器

Email 无法从外部邮件服务器(如gmail)发送到postfix服务器,email,postfix,Email,Postfix,我在一个可公开访问的虚拟机上设置了一个postfix服务器,并对其进行了配置,使其能够向本地帐户以及其他邮件服务器(如gmail、yahoo e.t.c.)发送电子邮件。该域的SPF和DMARC记录设置得很好。问题是,当一封电子邮件从gmail、yahoo或其他外部邮件服务器发送到我的邮件服务器时,它永远不会到达那里。发送邮件服务器未显示任何错误(例如未送达错误e.t.c),并且我的接收服务器似乎未记录收到的此电子邮件。知道为什么我可以向其他邮件服务器发送电子邮件,但不能接收来自其他邮件服务器的

我在一个可公开访问的虚拟机上设置了一个postfix服务器,并对其进行了配置,使其能够向本地帐户以及其他邮件服务器(如gmail、yahoo e.t.c.)发送电子邮件。该域的SPF和DMARC记录设置得很好。问题是,当一封电子邮件从gmail、yahoo或其他外部邮件服务器发送到我的邮件服务器时,它永远不会到达那里。发送邮件服务器未显示任何错误(例如未送达错误e.t.c),并且我的接收服务器似乎未记录收到的此电子邮件。知道为什么我可以向其他邮件服务器发送电子邮件,但不能接收来自其他邮件服务器的电子邮件吗

sudo nmap -sS -O 127.0.0.1

Starting Nmap 7.01 ( https://nmap.org ) at 2018-03-09 10:50 UTC
Nmap scan report for localhost (127.0.0.1)
Host is up (0.000014s latency).
Not shown: 994 closed ports
PORT     STATE SERVICE
22/tcp   open  ssh
25/tcp   open  smtp
80/tcp   open  http
143/tcp  open  imap
443/tcp  open  https
5432/tcp open  postgresql
Device type: general purpose
Running: Linux 3.X
OS CPE: cpe:/o:linux:linux_kernel:3
OS details: Linux 3.12 - 3.19, Linux 3.8 - 3.19
Network Distance: 0 hops
/etc/postfix/main.cf

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.

smtpd_relay_restrictions = permit_mynetworks permit_sasl_authenticated defer_unauth_destination
myhostname = nectar.software
mydomain = nectar.software
alias_maps = hash:/etc/aliases
alias_database = hash:/etc/aliases
myorigin = /etc/mailname
mydestination = $myhostname, nectar.software, ip-172-31-25-62.ec2.internal, localhost.ec2.internal, localhost
relayhost =
mynetworks = 127.0.0.0/8 [::ffff:127.0.0.0]/104 [::1]/128
mailbox_size_limit = 0
recipient_delimiter = +
inet_interfaces = all
inet_protocols = all
home_mailbox = Maildir/
virtual_alias_maps = hash:/etc/postfix/virtual
# SMTP-Auth settings
smtpd_sasl_type = dovecot
smtpd_sasl_path = private/auth
smtpd_sasl_auth_enable = yes
smtpd_sasl_security_options = noanonymous
smtpd_sasl_local_domain = $myhostname
smtpd_recipient_restrictions = permit_mynetworks,permit_auth_destination,permit_sasl_authenticated,reject
/etc/postfix/master.cf

smtp      inet  n       -       y       -       -       smtpd
pickup    unix  n       -       y       60      1       pickup
cleanup   unix  n       -       y       -       0       cleanup
qmgr      unix  n       -       n       300     1       qmgr
#qmgr     unix  n       -       n       300     1       oqmgr
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 smtp_helo_timeout=5 -o smtp_connect_timeout=5
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

对于任何面临这个问题的人,我已经为邮件服务器设置了我的MX记录和所有其他要求。默认情况下,AWS实例中的SMTP端口已被阻止,但此信息不仅可从
netstat
获得,还可从查看AWS实例安全组的入站规则获得。

是否已为域设置MX记录?如果你应该接收电子邮件的虚拟机没有日志,那么gmail可能没有联系它。或者,您的外部VP前面是否有防火墙?你收到的邮件没有送到那里,你有什么错误吗?是的。我在Stephan创下了我的MX记录。事实证明,问题是默认情况下,创建的虚拟机带有被阻止的SMTP端口,这当然是一个好的做法:)