Okay I will try to clear this up.
Exchange has mailboxes and users that can access them and so the standard IMAP of just username is not enough.
When loging in with a exchange backend you need to specify the mailbox / username.
You can either get your users to put this into the username field ie "Username: test/paul.fryer"
Or update the login page to have a seperate input field ie "Username: paul.fryer" and "Mailbox: test"
For simplacity I will assume you only have one backend and it's an exchange 5 based server we will save the mailbox as a session var ($_SESSION['alias']) to make changes to the funcion calls as minimal as posible
This setup uses the mailbox as the username as this keeps the preferences per mailbox you could inverse it for preferences per alias
Step one
Update your localisation file to have a lable for the mailbox field
program/localization/en_GB/lables.inc
code example ?>
$labels = array();
// login page
$labels['welcome'] = 'Welcome to $product';
$labels['username'] = 'Username';
$labels['mailbox'] = 'Mailbox';
$labels['password'] = 'Password';
$labels['server'] = 'Server';
$labels['login'] = 'Login';
Step 2
Update the login form to ask for mailbox as well as the username
program/include/main.inc
Lines around 1425 on this older version install
function rcmail_login_form($attrib)
{
global $CONFIG, $OUTPUT, $SESS_HIDDEN_FIELD;
$labels = array();
$labels['user'] = rcube_label('mailbox');
$lables['alias'] = rcube_label('username');
$labels['pass'] = rcube_label('password');
$labels['host'] = rcube_label('server');
$input_user = new textfield(array('name' => '_user', 'id' => 'rcmloginuser', 'size' => 30, 'autocomplete' => 'off'));
$input_alias = new textfield(array('name' => '_alias', 'id' => 'rcmloginalias', 'size' => 30, 'autocomplete' => 'off'));
$input_pass = new passwordfield(array('name' => '_pass', 'id' => 'rcmloginpwd', 'size' => 30));
$input_action = new hiddenfield(array('name' => '_action', 'value' => 'login'));
$fields = array();
$fields['user'] = $input_user->show(get_input_value('_user', RCUBE_INPUT_POST));
$fields['alias'] = $input_alias->show(get_input_value('_alias', RCUBE_INPUT_POST));
$fields['pass'] = $input_pass->show();
$fields['action'] = $input_action->show();
Step 3
Get the posted alias to update the $_SESSION['alias'] var
program/include/rcube_imap.inc Line 148 on
EDIT: SORRY This should be index.php
// try to log in
if ($_action=='login' && $_task=='mail')
{
if(isset($_POST['_alias']))
{
$_SESSION['alias'] = $_POST['_alias'];
}
Step 4
Get the IMAP login to pass this along to the Exchange backend
program/include/rcube_imap.inc
lines 105 ish on
function connect($host, $user, $pass, $port=143, $use_ssl=FALSE)
{
global $ICL_SSL, $CONFIG, $ICL_PORT, $IMAP_USE_INTERNAL_DATE;
$exchange_login_user = 'domain_here/' . $_SESSION['alias'] . '/' . $user;
// check for Open-SSL support in PHP build
if ($use_ssl && in_array('openssl', get_loaded_extensions()))
$ICL_SSL = TRUE;
else if ($use_ssl)
{
raise_error(array('code' => 403, 'type' => 'imap', 'file' => __FILE__,
'message' => 'Open SSL not available;'), TRUE, FALSE);
$port = 143;
}
$ICL_PORT = $port;
$IMAP_USE_INTERNAL_DATE = false;
$this->conn = iil_Connect($host, $exchange_login_user, $pass, array('imap' => 'check'));
$this->host = $host;
$this->user = $user;
$this->pass = $pass;
$this->port = $port;
$this->ssl = $use_ssl;
/*
echo('
');
print_r($this->conn);
print_r($_SESSION);
echo('
');
die();
*/
Hope this helps
Let me know how you get on