Smtp
如何根據 From:Debian 上 exim4 中的地址選擇智能主機
我想路由帶有 From: through 的電子郵件和帶有 From:
.*@host1.com
through的smtp.server1.com
電子郵件。.*@host2.com``smtp.server2.com
目前,我已將 smarthost 配置為
dpkg-reconfigure exim4-config
包含update-exim4.conf.conf
該行dc_smarthost='smtp.server1.com::587'
。也就是說,一切都通過smtp.server1.com
.我嘗試在配置文件中的定義之前添加另一個路由器
smarthost:
,設置senders = .*@host2.com
smarthost_server2: debug_print = "R: smarthost_server2 for $local_part@$domain" driver = manualroute domains = ! +local_domains transport = remote_smtp_smarthost senders = .*@host2.com route_list = * smtp.server2.com byname host_find_failed = ignore same_domain_copy_routing = yes no_more
但 exim 仍然通過
smtp.server1.com
. 我senders
是否正確使用條件?AFAIU,對於有電子郵件的人來說,這應該是一個相當常見的設置。@google.com 和 . @gmail.com 不想在他們的@gmail.com 電子郵件標題中透露他們也是Google員工的事實,所以路由應該不同。
好,我知道了。
senders
是 /etc/mailname 提供的,而不是 From 的域部分:以下作品:
begin routers smarthost1: driver = manualroute domains = ! +local_domains condition = ${if match_domain{${domain:$h_From:}}{domain.com}{yes}{no}} transport = remote_domain_com_smtp route_data = domain.com::587 ignore_target_hosts = <; 0.0.0.0 ; 127.0.0.0/8 ; ::1 smarthost2: driver = manualroute domains = ! +local_domains condition = ${if match_domain{${domain:$h_From:}}{domain.org}{yes}{no}} transport = remote_domain_org_smtp route_data = domain.org::587 ignore_target_hosts = <; 0.0.0.0 ; 127.0.0.0/8 ; ::1 begin transports remote_domain_com_smtp: driver = smtp message_size_limit = ${if > {$max_received_linelength}{998} {1}{0}} hosts_require_auth = domain.com headers_remove = received return_path = ${address:$h_from:} remote_domain_org_smtp: driver = smtp message_size_limit = ${if > {$max_received_linelength}{998} {1}{0}} hosts_require_auth = domain.org return_path = ${address:$h_from:}
where
domain.com
和domain.org
分別是我要選擇的域。