diff --git a/CHANGELOG.md b/CHANGELOG.md index 926d05c8f3..b1d7f00da0 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -8,6 +8,7 @@ - Fix UI issue when dealing with an invalid managesieve_default_headers value (#9175) - Fix bug where images attached to application/smil messages weren't displayed (#8870) - Fix PHP string replacement error in utils/error.php (#9185) +- Fix regression where `smtp_user` did not allow pre/post strings before/after `%u` placeholder (#9162) ## Release 1.6.4 diff --git a/config/defaults.inc.php b/config/defaults.inc.php index 85481d22b4..bfa09da1da 100644 --- a/config/defaults.inc.php +++ b/config/defaults.inc.php @@ -270,12 +270,12 @@ // of IMAP host (no prefix or port) and SMTP server e.g. ['imap.example.com' => 'smtp.example.net'] $config['smtp_host'] = 'localhost:587'; -// SMTP username (if required) if you use %u as the username Roundcube -// will use the current username for login +// SMTP username (if required) +// Note: %u variable will be replaced with current user's username $config['smtp_user'] = '%u'; -// SMTP password (if required) if you use %p as the password Roundcube -// will use the current user's password for login +// SMTP password (if required) +// Note: When set to '%p' current user's password will be used $config['smtp_pass'] = '%p'; // SMTP AUTH type (DIGEST-MD5, CRAM-MD5, LOGIN, PLAIN or empty to use diff --git a/program/lib/Roundcube/rcube_smtp.php b/program/lib/Roundcube/rcube_smtp.php index ff9c55298a..94d0d70647 100644 --- a/program/lib/Roundcube/rcube_smtp.php +++ b/program/lib/Roundcube/rcube_smtp.php @@ -170,18 +170,13 @@ public function connect($host = null, $port = null, $user = null, $pass = null) } } - if ($CONFIG['smtp_user'] == '%u') { - $smtp_user = (string) $rcube->get_user_name(); - } else { - $smtp_user = $CONFIG['smtp_user']; - } - if ($CONFIG['smtp_pass'] == '%p') { $smtp_pass = (string) $rcube->get_user_password(); } else { $smtp_pass = $CONFIG['smtp_pass']; } + $smtp_user = str_replace('%u', (string) $rcube->get_user_name(), $CONFIG['smtp_user']); $smtp_auth_type = $CONFIG['smtp_auth_type'] ?: null; $smtp_authz = null;