IMAP addresses picking up server username

I have an interesting problem where I have installed Roundcube webmail on the server (I have Virtualmin Pro) - when I set up an account roundcube is picking up email addresses as instead of

This obviously is a big problem because the reply-to addresses are incorrect and mail is being bounced - currently I have to manually change these settings, but I need to know how to have it set up on the server so that when I create a new email address I don’t have to go and manually change the settings.



This requires some support from Round Cube in order to figure out the correct mapping. I’m not sure whether such a plugin exists–SquirrelMail has a virtual hosting plugin for this purpose. Usermin has built-in support for Postfix virtual maps and Sendmail generics tables.

Ah, looks like it can handle it:

I think that’s the same format as in /etc/postfix/virtual.

If it works, let me know, and I’ll add it to the default installation configuration in Install Scripts.

Hi Joe,

Thanks for the heads up on the link - that works fine with postfix.



For me the adress works but how can I get roundcube to use the Real Name in front of the mail adress instead of the login? Where does virtualmin save that "Real Name"? Would there be a way to use that instead or to integrate it in /etc/postfix/virtual?
In Usermin it works perfect.

As sender it choses
forename.domain<> instead of

Forename Surname<>

obviously it uses /etc/postfix/virtual for the naming which looks like that: forename.domain

it should be

forename.domain<> instead of

Forename Surname<>

When i want to edit my entry i get:
Oops! You’ve hit a bug in the forum software. It’ll be fixed soon. whe


I think I found a way to make this work…

  1. make sure you set ‘virtuser_file’ to /etc/postfix/virtual in the roundcube config file (

  2. apply this change to <roundcube-path>/program/include/rcube_user.php, around line 385 or so (using roundcube 0.2 stable)

// replaced this original code
// $user_name = $user != $user_email ? $user : ‘’;
// with call to awk (linux utility for text/pattern manipulation)
// that compares the #1 column of /etc/passwd with $user and returns value of #5 column (full name)
// if no usable return value, the original code is used
// it seems exec() returns 0 even if the search string was not found, so $awk_return_value is not used
exec(“awk -F: ‘($1==U){print $5}’ U=$user /etc/passwd”, $awk_output, $awk_return_value);

	if($awk_output[0] &lt;&gt; ''){
		$user_name = $awk_output[0];
	} else {
		$user_name = $user != $user_email ? $user : '';



Step 1) above will map the correct email address to the login account used to log into roundcube

Step 2) attempts to find the Full Name from the /etc/passwd file (you enter this for every account and email user you create) by looking for the login name used to get into roundcube — it effectively instructs awk to search in column 1 (the login names) for the login name used and return the value of column 5 (the Full Name); IF awk doesn’t find anything, the original line of code from the roundcube release is used instead.

Result: 1) makes email addresses in From: appear correctly; 2) makes the user’s first and last name show up in Personal Settings in roundcube without the end user having to set it up manually.

Hope this works for others, too!