Re: [exim] more than one smtp transport bounded to several i…

Top Page
Delete this message
Reply to this message
Author: Wouter Verhelst
Date:  
To: Johannes Nohl
CC: exim-users
Subject: Re: [exim] more than one smtp transport bounded to several ipadresses
On Sat, Jan 26, 2008 at 09:44:20PM +0100, Johannes Nohl wrote:
> Dear list,
>
> I'm using postfix right now but what I need isn't possible within
> postfix. To be correct it isn't possible as long as you run just one
> instance. I don't want to have more than one instance because I like
> to have one setup and one queue.
>
> Now I want to switch to exim. But is the following possible then?
>
> 1) Can I configure exim to have several smtp transports? Like mails
> with sender *@dom1.tld will be sent by smtp1, *@dom2.tld by smtp2...


Yes, no problem at all. Something like this:

smarthost:
driver = dnslookup
transport = ${lookup {$sender_address_domain}lsearch{/etc/exim/smarthosts}}

With that, you'd have to create a file /etc/exim/smarthosts like this:

dom1.tld: smtp1
dom2.tld: smtp2

Note that $sender_address_domain contains the domain in the envelope
from. If you want something else (e.g., the from header rather than the
envelope from), then you'd need to use some other expansion variable.
Please see the exim manual for a full list, under "Expansion variables".

> 2) Can I bind those different transports (smtp1, smtp2, ...) to
> different IPs? Like exim MTA is listening on all IPs. But to send it
> is using different IPs.


Yes, with the "interface" option of the "smtp" transport:

smtp1:
driver = smtp
interface = 192.168.1.1

Or whatever IP addresses you want to specify.

Note also that if this is the only reason you want to create separate
transports, that it is not necessary; rather than doing the lookup above
at router time, you could do it in the "interface" option of the smtp
router:

remote_smtp:
driver = smtp
interface = ${lookup {$sender_address_domain}lsearch{/etc/exim/ips}}

with /etc/exim/ips containing something like

dom1.tld: 192.168.1.1
dom2.tld: 192.168.1.2

This would spare you a considerable amount of transports, and would make
your setup slightly more flexible...

--
<Lo-lan-do> Home is where you have to wash the dishes.
-- #debian-devel, Freenode, 2004-09-22