Roundcube Community Forum

Release Support => Release Discussion => Topic started by: Nicram on June 01, 2022, 07:31:01 AM

Title: How to autoselect server based on email domain?
Post by: Nicram on June 01, 2022, 07:31:01 AM
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 [email protected] is logging in, it use "server1.domain.com", and when [email protected] 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';
$config['username_domain'] = 'domainY.com';
$config['smtp_server'] = 'tls://server2.domain.com.inc.php';

and i've added $config['include_host_config'] = true; inside config.inc.php. But it also didn't help me.
Title: Re: How to autoselect server based on email domain?
Post by: Alexander1222 on November 29, 2024, 10:58:18 AM
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' => 'First item in combobox',
 'tls://mx.domain2.com:143' => 'Second item in combobox'
);

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