Re: [exim] Configuring Exim to make manual routing decision …

Página Principal
Apagar esta mensagem
Responder a esta mensagem
Autor: Andryan
Data:  
Para: Chris Siebenmann
CC: exim-users
Assunto: Re: [exim] Configuring Exim to make manual routing decision based on MX records of recipient domains
Hi Chris,

Thanks for the insight!

I couldn't get it working with mx_domains. I guess I misread the docs and
somehow had this idea that mx_domains directive can be used for my need.

I got it working now with the following:

smarthost_dkim:
driver = dnslookup
domains = !+local_domains
require_files =
"+/var/cpanel/domain_keys/private/${sender_address_domain}"
transport = remote_smtp_smart_dkim
ignore_target_hosts = ! /etc/mail_ips_of_domains_to_be_relayed

smarthost_regular:
driver = dnslookup
domains = !+local_domains
transport = remote_smtp_smart_regular
ignore_target_hosts = ! /etc/mail_ips_of_domains_to_be_relayed

remote_smtp_smart_dkim:
driver = smtp
hosts_require_tls = *
interface = ${if exists
{/etc/mailips}{${lookup{$original_domain}lsearch{/etc/mailips}{$value}{${lookup{$sender_address_domain}lsearch{/etc/mailips}{$value}{${lookup{${perl{get_sender_from_uid}}}lsearch*{/etc/mailips}{$value}{}}}}}}}}
helo_data = ${if exists
{/etc/mailhelo}{${lookup{$original_domain}lsearch{/etc/mailhelo}{$value}{${lookup{$sender_address_domain}lsearch{/etc/mailhelo}{$value}{${lookup{${perl{get_sender_from_uid}}}lsearch*{/etc/mailhelo}{$value}{$primary_hostname}}}}}}}{$primary_hostname}}
dkim_domain = $sender_address_domain
dkim_selector = default
dkim_private_key = "/var/cpanel/domain_keys/private/${dkim_domain}"
dkim_canon = relaxed
hosts_require_auth = *
hosts = smtp.sendgrid.net
hosts_override = yes

remote_smtp_smart_regular:
driver = smtp
hosts_require_tls = *
interface = ${if exists
{/etc/mailips}{${lookup{$original_domain}lsearch{/etc/mailips}{$value}{${lookup{$sender_address_domain}lsearch*{/etc/mailips}{$value}{${lookup{${perl{get_sender_from_uid}}}lsearch*{/etc/mailips}{$value}{}}}}}}}}
helo_data = ${if exists
{/etc/mailhelo}{${lookup{$original_domain}lsearch{/etc/mailhelo}{$value}{${lookup{$sender_address_domain}lsearch{/etc/mailhelo}{$value}{${lookup{${perl{get_sender_from_uid}}}lsearch*{/etc/mailhelo}{$value}{$primary_hostname}}}}}}}{$primary_hostname}}
hosts_require_auth = *
hosts = smtp.sendgrid.net
hosts_override = yes

The file /etc/mail_ips_of_domains_to_be_relayed is a list of IPs of the MX
of Gmail/Hotmail/Yahoo in CIDR format.

This works as I expected, Exim with recipient's domain MX-based routing
decision. :)

Much thanks, Chris!


Cheers,
Andryan


On Thu, Aug 29, 2013 at 10:24 PM, Chris Siebenmann <cks@???>wrote:

> | [...] I did my research on this and found out that I need a dnslookup
> | router with mx_domains directive (rather than manualroute) to be able
> | to make decision based on the MX of the recipients' domain.
> |
> | Now I came to a problem where I cannot use mx_domains inside
> | manualroute, nor use route_list inside dnslookup. How do I get around
> | this problem? Is there a clever trick to be able to achieve what I
> | need? I was thinking the solution shall remain to be a manualroute
> | router with additional condition to do a lookup on the recipients'
> | domains MX records. Can a perl script be implemented to achieve this?
>
> You can do what you want with a special version of the SMTP transport
> that uses the 'hosts' and 'hosts_override' SMTP transport settings:
>
>         remote_smtp_esp:
>                 debug_print = "T: remote_smtp_esp for $local_part@$domain"
>                 driver = smtp
>                 hosts = ESP_HOST
>                 hosts_override = true

>
> In your special mx_domains-based dnslookup router, just set this
> transport instead of your regular SMTP transport.
>
> (We use a version of this here to do special routing for some outgoing
> messages.)
>
>         - cks

>