ubuntu – 使用postfix停止发送到中继主机的本地电子邮件

前端之家收集整理的这篇文章主要介绍了ubuntu – 使用postfix停止发送到中继主机的本地电子邮件前端之家小编觉得挺不错的,现在分享给大家,也给大家做个参考。
我最近注册了SMTP2GO(smtpcorp).我在其中一台EC2服务器上安装了postfix,并将其指向我的smtp2go帐户:
relayhost = [smtpcorp.com]:2525

现在我的所有邮件都通过SMTP2GO路由,但问题是,cron job ect生成的1000封电子邮件正在使用电子邮件地址发送到SMTP2GO:

root@ec2-46-51-151-256.eu-west-1.compute.amazonaws.com

我的问题是,阻止所有这些“本地”电子邮件路由到SMTP2GO的最佳方法是什么?

谢谢

马丁

我的main.cf:

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

append_dot_mydomain = no


readme_directory = no

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



myhostname = ec2-46-51-151-256.eu-west-1.compute.amazonaws.com

alias_maps = hash:/etc/aliases
alias_database = hash:/etc/aliases
myorigin = /etc/mailname

mydestination = ec2-46-51-151-256.eu-west-1.compute.amazonaws.com,localhost.eu-west-1.compute.internal,localhost

relayhost = [smtpcorp.com]:2525
smtp_sasl_auth_enable = yes
smtp_sasl_password_maps = static:account:password
smtp_sasl_security_options = noanonymous
smtp_tls_security_level = may
header_size_limit = 4096000
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 = ipv4
Postfix relayhost通常不会向本地邮件发送本地邮件

postfix.org开始:

relayhost(默认值:空)

The next-hop destination of non-local mail; overrides non-local domains in recipient addresses. This information is overruled with relay_transport,sender_dependent_default_transport_maps,default_transport,sender_dependent_relayhost_maps and with the transport(5) table.

因此,如果它正在发生,那是因为您的本地邮件未被识别为本地邮件.您需要在mydestination = config行中包含您的本地域.我看到你有ec2 -…. amazonaws.com,但可能你已经为你的局域网定义了一个不同于本地的域.如果您没有定义本地域,我认为(需要测试)如果您只在etc / hosts文件添加127.0.0.1 localhost.localdomain localhost并将localhost.localdomain添加到mydestination =它应该就足够了.

猜你在找的Ubuntu相关文章