Re: [exim] Change IP for different senders

Página Inicial
Delete this message
Reply to this message
Autor: Phil Pennock
Data:  
Para: technique@dreamhosting.fr
CC: Exim-users
Assunto: Re: [exim] Change IP for different senders
On 2011-02-15 at 21:26 +0100, technique@??? 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 user1@???, I want to use IP aaa.aaa.aaa.aaa
> If message is sent by user2@???, 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:
  user1@???:    aaa.aaa.aaa.aaa
  user2@???:    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