summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authoralecpl <alec@alec.pl>2009-07-07 08:36:42 +0000
committeralecpl <alec@alec.pl>2009-07-07 08:36:42 +0000
commit72cd3c1a761fad73235cad32f240a114ba2941aa (patch)
tree9220255bf80d1181e72bbcfe57d37971af4a8ac1
parent16036b9c862f298927454235ce79b131df3f25bf (diff)
- Support %h variable in 'smtp_server' option (#1485766)
-rw-r--r--CHANGELOG1
-rw-r--r--config/main.inc.php.dist1
-rw-r--r--program/include/rcube_smtp.inc6
-rw-r--r--program/lib/imap.inc5
4 files changed, 8 insertions, 5 deletions
diff --git a/CHANGELOG b/CHANGELOG
index 2e94ea357..869651f86 100644
--- a/CHANGELOG
+++ b/CHANGELOG
@@ -1,6 +1,7 @@
CHANGELOG RoundCube Webmail
===========================
+- Support %h variable in 'smtp_server' option (#1485766)
- Show SMTP errors in browser (#1485927)
- Allow WBR tag in HTML message (#1485960)
- Use spl_autoload_register() instead of __autoload (#1485947)
diff --git a/config/main.inc.php.dist b/config/main.inc.php.dist
index f5e4c7ccc..b456db935 100644
--- a/config/main.inc.php.dist
+++ b/config/main.inc.php.dist
@@ -98,6 +98,7 @@ $rcmail_config['virtuser_query'] = '';
// use this host for sending mails.
// to use SSL connection, set ssl://smtp.host.com
// if left blank, the PHP mail() function is used
+// Use %h variable as replacement for user's IMAP hostname
$rcmail_config['smtp_server'] = '';
// SMTP port (default is 25; 465 for SSL)
diff --git a/program/include/rcube_smtp.inc b/program/include/rcube_smtp.inc
index 066e5ed47..db681af05 100644
--- a/program/include/rcube_smtp.inc
+++ b/program/include/rcube_smtp.inc
@@ -64,10 +64,10 @@ function smtp_mail($from, $recipients, &$headers, &$body, &$response, &$error)
));
$smtp_timeout = null;
- $smtp_host = $CONFIG['smtp_server'];
+ $smtp_host = str_replace('%h', $_SESSION['imap_host'], $CONFIG['smtp_server']);
$smtp_port = is_numeric($CONFIG['smtp_port']) ? $CONFIG['smtp_port'] : 25;
- $smtp_host_url = parse_url($CONFIG['smtp_server']);
-
+ $smtp_host_url = parse_url($smtp_host);
+
// overwrite port
if (isset($smtp_host_url['host']) && isset($smtp_host_url['port']))
{
diff --git a/program/lib/imap.inc b/program/lib/imap.inc
index c6b5000ff..7b40c020b 100644
--- a/program/lib/imap.inc
+++ b/program/lib/imap.inc
@@ -260,7 +260,6 @@ function iil_MultLine($fp, $line, $escape=false) {
}
$line = $a[1][0] . '"' . ($escape ? iil_Escape($out) : $out) . '"';
-// console('[...] '. $out);
}
return $line;
}
@@ -269,10 +268,12 @@ function iil_ReadBytes($fp, $bytes) {
$data = '';
$len = 0;
do {
- $data .= fread($fp, $bytes-$len);
+ $d = fread($fp, $bytes-$len);
+ $data .= $d;
if ($len == strlen($data)) {
break; //nothing was read -> exit to avoid apache lockups
}
+// console('[...] '. $d);
$len = strlen($data);
} while ($len < $bytes);