在我家的 Ubuntu 机器上,postfix 配置为将所有外发电子邮件转发到outgoing.verizon.net
。不幸的是,这包括本地用户到用户的电子邮件(例如,从本地 cron 作业到我,或从我到我自己),这些电子邮件不应该离开机器。有没有办法调整我的配置(如下),以便本地电子邮件无需离开我的机器即可传递?
注意:我没有运行邮件服务器(在端口 25 上),而是每五分钟运行一次 fetchmail 从 IMAP 服务器下载。
主文件:
smtpd_relay_restrictions = permit_mynetworks permit_sasl_authenticated defer_unauth_destination
myhostname = mycomputer.example.com
masquerade_domains = example.com
alias_maps = hash:/etc/aliases
alias_database = hash:/etc/aliases
myorigin = /etc/mailname
mydestination = $myhostname, localhost.localdomain, localhost
relayhost = [outgoing.verizon.net]:587
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
smtp_sasl_auth_enable = yes
smtp_sasl_auth_enable = yes
smtp_sasl_password_maps = hash:/etc/postfix/sasl_passwd
smtp_sasl_security_options =
smtpd_sasl_auth_enable = no
答案1
Postfix 将仅中继non-local mails
到 中指定的主机relayhost
。要将域视为本地域;域必须在mydestination
参数下列出。因此,列出example.com
应该mydestination
可以帮助您解决此问题。
#/etc/postfix/main.cf
#...
mydestination = $myhostname, localhost.localdomain, localhost, example.com
#...
参考:Postfix 文档
relayhost (default: empty)
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.