Roundcube Community Forum

 

How to autoselect server based on email domain?

Started by Nicram, June 01, 2022, 07:31:01 AM

Previous topic - Next topic

Nicram

Hello.
My users use full email address for login into Roundcube 1.5.2.
I'm setting up another email server, and i would like to use the same Roundcube site.

What i already done are those settings in config.inc.php:
Quote$config['default_host'] = array('server1.domain.com', 'server2.domain.com');
$config['smtp_server'] = 'tls://%h';

With this, at user login page, there is drop-down list where user can select correct server.
I would prefer, that when user@domainX.com is logging in, it use "server1.domain.com", and when user@domainY.com it use "server2.domain.com".
Is there any possibility to do that using confing.inc.php?
Thank You for help!

Update:
I found this: https://github.com/roundcube/roundcubemail/wiki/Configuration%3A-Multi-Domain-Setup
i made new file called server2.domain.com.inc.php in config directory.
Put inside:
Quote<?php

$config['default_host'] = 'tls://server2.domain.com.inc.php&#39;;
$config['username_domain'] = 'domainY.com';
$config['smtp_server'] = 'tls://server2.domain.com.inc.php&#39;;

and i've added $config['include_host_config'] = true; inside config.inc.php. But it also didn't help me.

Alexander1222

I'll leave a note for myself, the main difficulty was in finding the name of the array: smtp_server
unfortunately, it's not autoselect, but manual select by combobox below login/password boxes

$config['default_host'] = array(
 'tls://mx.domain1.com:143&#39; => 'First item in combobox',
 'tls://mx.domain2.com:143&#39; => 'Second item in combobox'
);

$config['smtp_server'] = array(
   'mx.domain1.com' => 'tls://mx.domain1.com:587&#39;,
   'mx.domain2.com' => 'tls://mx.domain2.com:587&#39;
);