Roundcube Community Forum

 

Roundcube Serverconfig for two differnt Mailserver

Started by ZerodaysystemDE, July 23, 2024, 02:30:12 PM

Previous topic - Next topic

ZerodaysystemDE

Hello,
I have a problem with my Roundcube server. I would like to enter two different mail servers in the config, which change depending on the username.

Example for entering username:

[email protected] --> Mail server 1

user --> mail server 2

Thank you for the upcoming ideas and help

JohnDoh

Roundcube supports dynamic setting of the imap host based on the user name.
// 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 tls:// for 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';

You problem comes from the second user with no domain as part of the username. This can be solved with a plugin which can set `imap_host` to what ever it wants but you can't handle it with just a config option.
Roundcube Plugins: Contextmenu, SpamAssassin Prefs, and more...