Re: [exim] mail routing depending on from- or even reply-to …

Top Page
Delete this message
Reply to this message
Author: Heiko Schlittermann
Date:  
To: exim-users
Subject: Re: [exim] mail routing depending on from- or even reply-to header possible?
Hello Thomas,


Thomas Stein <himbeere@???> (Do 19 Dez 2013 14:07:57 CET):
> Hello.
>
> I have a strange customer request. The cusomer wishes to use differnet
> smart hosts depending on from adress. Is this possible? My first try is
> not sooo successfull. Maybe someone did this in the past or has an idea?
> Thank you very much.


Here I've put together some example that should give you some idea.
If you really need the reply_to/from header, it's up to you… you may
change the setup. But beware … the router won't be usable for
verification anymore, since verification is done at the rcpt-to/mail-from
phase normally. At this point you do not know any header.

=======8<-----------------------------------------
# this is by no way a complete configuration file!
# it's just intended as a starting point

# The providers file
# All relevant information about the smart providers is stored
# in one place. This place is the "providers" file. The structure
# is simple. It consists of lines as in the example:
#
# # sender     |server[:port]  |user|password
# # -----------+---------------+----+---------
# foo@???   foobar.com      foo  secret
# *@bar.com     bar.com/mx:smtp fuz  secret2
# *             smtp.gmail.com  xxx  baz


PROVIDERS = <your file name for the providers file here>

# some macros to ease the understanding
ADDRESS_DATA = ${sg{${lookup{$sender_address}lsearch*@{PROVIDERS}}}{\\s+}{\t}}
SMARTHOST    = ${extract{1}{\x20\t}{$address_data}}
HOST         = ${extract{1}{:}{SMARTHOST}}
PORT         = ${extract{2}{:}{SMARTHOST}{$value}{submission}}
USER         = ${extract{2}{\t}{$address_data}}
PASS         = ${extract{3}{\t}{$address_data}}


domainlist local_domains = @

begin router

# the first router routes according the sender_address
smarthost:
        driver = manualroute
        address_data = ADDRESS_DATA
        route_data = HOST
        transport = smtp_auth


# in case you don't have a '*' line in your providers file

dnslookup:
        driver = dnslookup
        domains = !+local_domains
        transport = smtp
        no_more


begin transport

smtp_auth:
        driver = smtp
        hosts_require_auth = *
        port = PORT


smtp:
        driver = smtp


begin authenticators

plain:
        driver = plaintext
        public_name = PLAIN
        client_send = ^USER^PASS


login:
        driver = plaintext
        public_name = LOGIN     
        client_send = :USER:PASS
=======8<-----------------------------------------


    Best regards from Dresden/Germany
    Viele Grüße aus Dresden
    Heiko Schlittermann
-- 
 SCHLITTERMANN.de ---------------------------- internet & unix support -
 Heiko Schlittermann, Dipl.-Ing. (TU) - {fon,fax}: +49.351.802998{1,3} -
 gnupg encrypted messages are welcome --------------- key ID: 7CBF764A -
 gnupg fingerprint: 9288 F17D BBF9 9625 5ABC  285C 26A9 687E 7CBF 764A -
(gnupg fingerprint: 3061 CFBF 2D88 F034 E8D2  7E92 EE4E AC98 48D0 359B)-