Re: [exim] Outbound IP Address

Top Page
Delete this message
Reply to this message
Author: Ted Cooper
Date:  
To: exim-users
Subject: Re: [exim] Outbound IP Address
Grant Peel wrote:
> Hi all,
>
> I am toiling trying to set the outbound IP address (fo bandwidth accounting
> reasons), and have this so far:
>
> remote_smtp:
>         driver = smtp
>         helo_data = ${lookup 
> dnsdb{defer_never,ptr=$sender_address_domain}{$value{$primary_hostname}}
>         interface = ${lookup 
> dnsdb{defer_never,a=$sender_address_domain}{$value}{my.ip.host.here}}
>         return_path_add = true
>         debug_print = "XX T: remote_smtp for $local_part@$domain Sent VIA 
> ${lookup \
>                         dnsdb{defer_never,a=$sender_address_domain} \
>                         {$value}{my.host.ip.here}} XX"

>
> It seems to work ok if a virtual user logs in and sends an email to an
> outside server, it goes through OK and seemd to be reporting the right
> (outgoing) ip.
>
> However, if a mail comes into the server, addressed to an address that is an
> alias to another server (and domain), it fails miserably saying that 'can't
> assign requested address'. I am thinking that it is seeing the original
> sender's domain and trying to assing it as the outgoing address.
>
> Does anyone have any ideas here? ( or will I need to make another pair of
> remote_smtp Routers/Transports).


It looks to me like the $sender_address_domain might be something you
are not dealing with when a message comes from outside into the server.
ie If hotmail.com is not in your dnsdb, then the result of the lookup
will be empty and cause an error.

I would suspect separating out your router/transports would fix this
problem quite easily. A simple dnsdb lookup condition to see if should
be routing via that transport and a second to handle the case where it's
not one of your hosted domains.

If you want to keep a single router/transport and have the string
expansions figure it all out for you then you're going to have to wrap
those lookups in an ${if and test to see if the result is empty or not.
On an empty lookup, provide a default value which will work for that
situation.

Completely untested and unchecked:
${if eq{lookup{this}}{}{default-value}{$value}}

Since you probably wouldn't be actually doing anything with the sender
address, the pair of routers might be the way to go, even if one of them
has the no_verify option turned on.

Ted.