Roundcube Community Forum

 

Roundcube 1.3.17 (LTS) and 2 imap servers

Started by massimo2022, March 03, 2022, 05:42:25 AM

Previous topic - Next topic

massimo2022

Hi all,

i've 2 imap servers on different IP/servers/VM and some dozens of mail domains (a number on one imap servers and a number on another)

at the moment i run 2 different roundcube webmails, is it possible to use only one webmail for both imap servers?

If yes, how?
(any example of configuration)

thanks

massimo

SKaero

Yes there is a number of ways to set the imap_host

// The IMAP host (and optionally port number) chosen to perform the log-in.
// Leave blank to show a textbox at login, give a list of hosts
// to display a pulldown menu or set one host as string.
// Enter hostname with prefix ssl:// to use Implicit TLS, or use
// prefix tls:// to use STARTTLS.
// If port number is omitted it will be set to 993 (for ssl://) or 143 otherwise.
// Supported replacement variables:
// %n - hostname ($_SERVER['SERVER_NAME'])
// %t - hostname without the first part
// %d - domain (http hostname $_SERVER['HTTP_HOST'] without the first part)
// %s - domain name after the '@' from e-mail address provided at login screen
// For example %n = mail.domain.tld, %t = domain.tld
// WARNING: After hostname change update of mail_host column in users table is
//          required to match old user data records with the new host.
$config['imap_host'] = 'localhost:143';

massimo2022

i need to set 2

e.g. IP one and IP two

massimo

SKaero

If you have two domains you can do something like this:
User 1: [email protected]
User 2: [email protected]


$config['imap_host'] = [
    'example.com' => '192.168.0.1',
    'example.net' => '192.168.0.2',
];

massimo2022

unfortunately it don't work :(

$config['imap_host'] = [                                                           
'mydomain1.com' => '192.168.1.3',                                             
'mydomain2.com' => '127.0.0.1',                                             
];                                       

the 2nd work, the 1st not

massimo

SKaero

Sorry remembered it backwards, try:

$config['imap_host'] = [
    '192.168.0.1' => ['example.com'],
    '192.168.0.2' => ['example.net'],
];

massimo2022

same behaviour

the 2nd works, the 1st not

[04-Mar-2022 20:33:06 +0100]: <70fbcf4b> Failed login for [email protected] from 192.168.1.155 in session 70fbcf4b7b5bb13d67c5d95a9c4cd619 (error: 0)       

massimo