Make single Roundcube instance use multi different databases

I had to configure webmail service with Roundcube which would allow connecting multi mail servers o one platform. Every mail server had it’s own Roundcube instance already, but idea was, that only one installation can handle all mail servers.

I found out, that this can be done pretty symple with some php in roundcube configuration.

Open your roundcube configuration file, for example:

vi /var/www/roundcube/config/config.inc.php

Fetch correct hostname for specific webmail instance in php variable.

$host = $_SERVER['SERVER_NAME'];

Then you should create switch statement that will be able to manage correct database connection and host for specific server name – mail service. You can also have different types of database. For example mysql and postgres.

switch ($host) {
case "webmail1.domain.com":
$config['db_dsnw'] = 'mysql://rcdb1:somepass@1.1.1.1/roundcubemail';
$config['default_host'] = "mail1.domain.com";
break;
case "webmail2.domain.com":
$config['db_dsnw'] = 'pgsql://rcdb2:somepass2@2.2.2.2/roundcube';
$config['default_host'] = "ssl://mail2.domain.com";
break;
case "webmail3.domain.com":
$config['db_dsnw'] = 'mysql://rcdb4:somepass3@3.3.3.3/rc_db';
$config['default_host'] = "ssl://mail3.domain.com";
break;
}

Idea is, that when user will type url webmail1.domain.com, this hostname will be saved in $host. Switch statement will then use proper database and hostname for that specific hostname. Also, default_host should be defined so that correct hostname for mail server will be set.

I tried this on webmail instance with 4 different mail servers, with different database types also and it works.

RoundCube: Could not save new password. Connection error. Recv failure: Connection reset by peer

If you’re having trouble when try to change your email password in Roundcube on your Directadmin installation, than error will be probably something like this:

Could not save new password. Connection error. Recv failure: Connection reset by peer

Solution is simple. Just open Roundcube configuration file (/var/www/html/roundcube/plugins/password/config.inc.php) and find:

$rcmail_config['password_directadmin_host'] = 'tls://localhost';

then, change it to:

$rcmail_config['password_directadmin_host'] = 'ssl://localhost';

It should work.

cPanel Webmail: internal server error 500 user is over quota cpanel

This user cpanel account reached disk quota limit and mail stopped working. User deleted about 4G of emails and released some disk space. Problem was that he still wasn’t able to login to webmail. This error was shown:

internal server error 500 user is over quota cpanel

It didn’t make sense since he released his disk space. Cpanels quota was showing new value, but login to webmail was still impossible.

What you have to do is remove cpanels overquota file manually. Let’s say that user user4 is having issue described above.

root@cpanel [~]# cd /var/cpanel/overquota/
root@cpanel [/var/cpanel/overquota]# ls
./  ../  user1  user2  user3  user4 
root@cpanel [/var/cpanel/overquota]# rm user4

After I deleted /var/cpanel/overquota/user4, webmail was started to working again.

© 2020 geegkytuts.net
Hosted by Hosterdam


About author