On 2021-08-31, Effendy Abdullah via Exim-users <exim-users@???> wrote:
> On 2021-08-31 19:52, Cyborg wrote:
>> Am 27.08.21 um 15:35 schrieb Effendy Abdullah via Exim-users:
>> > Hi,
>> >
>> > How do I route to one Smart Host for certain domain and all other domain route to another Smart Host. Using WHM/cPanel with Exim.
>
> I think I didn't make myself clear.
> I'm using MailGun as a smartest with one "default" credentials, with about 80 domains. Some of the domain will be using their own login credentials for MailGun.
>
> So my current Exim config in WHM is as follows:
>
> #Section: AUTH
> mailgun_login:
> driver = plaintext
> public_name = LOGIN
> hide client_send = : ${extract{user}{${lookup{$sender_address_domain}lsearch{/etc/exim_smarthosts}}}}: ${extract{pass}{${lookup{$sender_address_domain}lsearch{/etc/exim_smarthosts}}}}
A:
change lsearch to nwildlsearch
add a * entry at the end of the /etc/exim_smarthosts file. that entry has the default credentials
or
B:
use the not-found branch of "lsearch" or "extract" to get the default
credentials.
which means code like:
hide client_send = : \
${extract{user}{${lookup{$sender_address_domain}lsearch{/etc/exim_smarthosts}{$value}{DEFAULTUSER}}}}:\
${extract{pass}{${lookup{$sender_address_domain}lsearch{/etc/exim_smarthosts}{$value}{DEFAULRPASS}}}}
or
hide client_send = : \
${extract{user}{${lookup{$sender_address_domain}lsearch{/etc/exim_smarthosts}}}{$value}{DEFAULTUSER}}:\
${extract{pass}{${lookup{$sender_address_domain}lsearch{/etc/exim_smarthosts}}}{$value}{DEFAULRPASS}}
--
Jasen.