我想要路由带有发件人:.*@host1.com
至的电子邮件smtp.server1.com
和带有发件人:.*@host2.com
至的电子邮件smtp.server2.com
。
目前,我已将智能主机配置为,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
正确使用了条件?
据我所知,对于有电子邮件的人来说,这应该是一种相当常见的设置。@google.com 和 .@gmail.com 不想在他们的 @gmail.com 电子邮件标题中透露他们也是谷歌员工的事实,所以路由应该有所不同。
答案1
好的,我明白了。senders
是 /etc/mailname 提供的,而不是发件人的域部分:
以下工作:
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:}
其中domain.com
和domain.org
分别是我想要选择的域。