On 2011-02-15 at 21:26 +0100, [email protected] wrote:
> Is it possible to send email from different IP, depending on email address ?
> 
> Example :
> I have a domain : domain.com
> 
> If message is sent by [email protected], I want to use IP aaa.aaa.aaa.aaa
> If message is sent by [email protected], I want to use IP aaa.aaa.aaa.bbb
> 
> Is it possible ?

Yes.

> And how to do this ?

Assume that you have a file /path/to/data/ips_for_sender:
  [email protected]:     aaa.aaa.aaa.aaa
  [email protected]:     aaa.aaa.aaa.bbb

Before your normal "dnslookup" Router, have:

  dns_override_sendip:
    driver = dnslookup
    domains = !+local_domains
    senders = lsearch;/path/to/data/ips_for_sender
    address_data = $sender_data
    transport = remote_smtp_fromip

Then define a transport:

  remote_smtp_fromip:
    driver = smtp
    interface = $address_data

So, the new Router checks the sender against a file, doing an "lsearch"
lookup which checks for the key in the file.  The value from that file
is temporarily in $sender_data; we save it away using the address_data
option, which makes it available in $address_data in the Transport.

The Transport option "interface" declares which IP address to use when
sending.

-Phil
i

-- 
## List details at http://lists.exim.org/mailman/listinfo/exim-users 
## Exim details at http://www.exim.org/
## Please use the Wiki with this list - http://wiki.exim.org/

Reply via email to