Postfix 已配置,可以使用 gmail 域中继发送电子邮件。但是 Postfix 无法接收来自外部域的电子邮件。
我的内部电子邮件是:[电子邮件保护]
版本:Ubuntu 17.10 (Artful Aardvark);Postfix 3.2.3
以下是我的设置;
在配置了 postfix 的 GCP 中,端口 25 和 587 已打开
在配置了 postfix 的 Linux 中创建了一个用户商业名称
MX 和 A DNS 已设置,您可以在下面看到 dig linux 命令生成的报告:
以下是我的额外设置;
something.com. 59 IN MX 10 mail.something.com.
mail.something.com. 59 IN A <SOMETHING IP ADDRESS>
$ sudo postconf -n
alias_database = hash:/etc/aliases
alias_maps = hash:/etc/aliases
append_dot_mydomain = no
biff = no
compatibility_level = 2
home_mailbox = Maildir/
inet_interfaces = all
inet_protocols = all
mailbox_size_limit = 0
mydestination = $myhostname mail.$myhostname localhost.$mydomain localhost
myhostname = something.com
mynetworks = 127.0.0.0/8 [::ffff:127.0.0.0]/104 [::1]/128
myorigin = /etc/mailname
readme_directory = no
recipient_delimiter = +
relayhost = [smtp.gmail.com]:587
smtp_sasl_auth_enable = yes
smtp_sasl_password_maps = hash:/etc/postfix/sasl_passwd
smtp_sasl_security_options =
smtp_tls_CAfile = /etc/ssl/certs/ca-certificates.crt
smtp_tls_session_cache_database = btree:${data_directory}/smtp_scache
smtp_use_tls = yes
smtpd_banner = $myhostname ESMTP $mail_name (Ubuntu)
smtpd_relay_restrictions = permit_mynetworks permit_sasl_authenticated defer_unauth_destination
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_alias_maps = hash:/etc/postfix/virtual
$ sudo postconf -M
smtp inet n - y - - smtpd
submission inet n - y - - smtpd
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
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
maildrop unix - n n - - pipe flags=DRhu 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=FR user=list argv=/usr/lib/mailman/bin/postfix-to-mailman.py ${nexthop} ${user}
我花了很多时间试图解决这个问题,但直到现在我都无法解决,因为这可能不是我的主要技能。我正在变得更好......
能不能请你检查一下并指导我打开 postfix 来接收电子邮件?谢谢
答案1
你的mydestination
没有mail.example.com
,只有朴素的example.com
。
mydestination = $myhostname localhost.$mydomain localhost
myhostname = example.com
您可以像这样添加它:
mydestination = $myhostname mail.$myhostname localhost.$mydomain localhost
但是,您可能希望接收 的邮件[email protected]
,而不是mail.example.com
?为此,您需要MX
为其设置,而不是:
example.com. IN MX 10 mail.example.com.
mail.example.com. IN A 198.51.100.100