On 24.01.2012 10:37, Marius Stan wrote:
> Hello all,
>
> I'm currently throttling mail using the following setup:
>
> domainlist throttled_domains = yahoo.com : yahoo.co.uk : yahoo.ca :
> yahoo.es yahoo.it
>
> # This router limits the messages per outbound SMTP conenction:
> throttled_out:
> driver = dnslookup
> domains = +throttled_domains
> transport = smtp_throttled
> ignore_target_hosts = 0.0.0.0 : 127.0.0.0/8
> no_more
>
> smtp_throttled:
> driver = smtp
> max_rcpt = 9
> connection_max_messages = 5
>
> What I'd also like to do is to limit max_rcpt based on the MX of the
> recipient. Something along the lines:
>
> hostlist throttled_mx = mx1.domain.com : mx2.domain.com
>
> And with a condition in a new router (forgive my pseudo-code):
>
> condition: if lookup $recipient_mx in $throttled_mx then true
>
>
> Is this possible ?
Yes it is :)
Here's how I managed to solve it:
THROTTLED_SERVERS=relay1.romtelecom.net : relay2.romtelecom.net
[..]
# This router limits the messages per outbound MX conenction:
throttled_out2:
driver = dnslookup
domains = !+local_domains
condition = ${if forany{${lookup dnsdb{>:
mxh=$domain}}}{inlisti{$item}{THROTTLED_SERVERS}}}
transport = smtp_throttled
ignore_target_hosts = 0.0.0.0 : 127.0.0.0/8
no_more
But I had to upgrade to exim 4.77 in order to get the "ïnlist" function.
Looks like there's no way to have two nested forany, as $item gets
rewritten.
And i had to define that macro THROTTLED_SERVERS, because the hostlist
below doesn't get expanded ?!:
hostlist throttled_servers=relay1.romtelecom.net : relay2.romtelecom.net
[..]
condition = ${if forany{${lookup dnsdb{>:
mxh=$domain}}}{inlisti{$item}{+throttled_servers}}}