roundcube on virtualmin GPL

I’ve installed roundcube on my ubuntu server. It seems to work well with a few problems:

  • i have to enter the domain at login, but i fixed this in main.inc.php with:

[code:1]$sn = $_SERVER[‘SERVER_NAME’];
$t = substr($sn, 0, strrpos($sn, ‘.’));
$pos = strpos($t, ‘.’);
if ($pos !== false) $sn = substr($sn, $pos+1);
$rcmail_config[‘default_host’] = $sn;
[/code:1]
This basically makes it domain.com when accessing by http://www.domain.com/roundcube-webmail

The problem i’m having now is with the usernames that Virtualmin makes. For example, I make a new (email/ftp) user for a domain, and i name him “jonas”. It makes the username “jonas.domain”. I can log in, but roundcube then displays the sender as “jonas.domain@domain.com” instead of “jonas@domain.com”.

Any ideas how to fix this? Also is it possible for "jonas.domain" to login as "jonas", so as to avoid confusion with customers?

Thanks!

duplicate,ignore<br><br>Post edited by: mrbrdo, at: 2009/03/28 20:57

Well, "jonas.domain" is the username on the system, and RoundCube is correctly using the system names for authentication.

The way to fix that would be to generate different usernames :slight_smile:

You can tweak how Virtualmin names them by looking at System Settings -> Module Config -> Defaults for new domains, and change "Include domain name in usernames" to be "Only to avoid a clash".
-Eric

Well, with those settings i pasted above, it works ok for ‘additional’ users (they have to login with username.domain, but i can live with that). The problem is the first user that virtualmin adds by itself does not have the domain suffix, but the even bigger problem is that if you login to roundcube using that username, the ‘sender’ email is set to “username@localhost”.
With the other names it works correctly as “username@domain.com”, i think because of the line in config:

[code:1]$rcmail_config[‘virtuser_file’] = ‘/etc/postfix/virtual’;[/code:1]

So any idea how to make it work with the first username aswell?

If you are using Postfix and have “Domain mapping lookup tables” set to hash:/etc/postfix/virtual (default I believe), then there isn’t much you can do since the virtual alias table has only two entries per address, the email address and the username that is by default formatted as user.domain. Roundcube is reading this table to get its information regarding the email account. As was already mentioned, it is reading this correctly.

What I did to get around this problem was to edit program/include/rcube_user.php and change:

  • version 0.2.2
    line 389 from:

    strip_newlines($user_name),

    to:

    strip_newlines($user_email),

  • version .2-stable
    lines 389 and 402 from:

    strip_newlines($user_name),

    to:

    strip_newlines($user_email),

What this does is force the identity to use the email address since RoundCube cannot know based on the virtual alias table what the identity should really be

Hope that helps,

Chris