Permalink
Browse files

- support dynamic hostname variables in 'username_domain' option

  • Loading branch information...
1 parent 073543a commit 6a642d1a2e4029fd1462e68d43a55ca1b6351f01 @alecpl alecpl committed Jun 7, 2010
Showing with 7 additions and 2 deletions.
  1. +5 −0 config/main.inc.php.dist
  2. +2 −2 program/include/rcmail.php
View
@@ -180,6 +180,11 @@ $rcmail_config['des_key'] = 'rcmail-!24ByteDESkey*Str';
// Automatically add this domain to user names for login
// Only for IMAP servers that require full e-mail addresses for login
// Specify an array with 'host' => 'domain' values to support multiple hosts
+// Supported replacement variables:
+// %h - user's IMAP hostname
+// %n - http hostname ($_SERVER['SERVER_NAME'])
+// %d - domain (http hostname without the first part)
+// For example %n = mail.domain.tld, %d = domain.tld
$rcmail_config['username_domain'] = '';
// This domain will be used to form e-mail addresses of new users
@@ -597,9 +597,9 @@ function login($username, $pass, $host=NULL)
// Check if we need to add domain
if (!empty($config['username_domain']) && !strpos($username, '@')) {
if (is_array($config['username_domain']) && isset($config['username_domain'][$host]))
- $username .= '@'.$config['username_domain'][$host];
+ $username .= '@'.rcube_parse_host($config['username_domain'][$host]);
else if (is_string($config['username_domain']))
- $username .= '@'.$config['username_domain'];
+ $username .= '@'.rcube_parse_host($config['username_domain']);
}
// try to resolve email address from virtuser table

0 comments on commit 6a642d1

Please sign in to comment.