summaryrefslogtreecommitdiff
path: root/roundcubemail/program/include
diff options
context:
space:
mode:
authoralec <alec@208e9e7b-5314-0410-a742-e7e81cd9613c>2010-03-05 09:47:32 +0000
committeralec <alec@208e9e7b-5314-0410-a742-e7e81cd9613c>2010-03-05 09:47:32 +0000
commit13fc24bcc3eb1b8ad141a2700918533acd83203e (patch)
treed9447b7fb48bb0f63f3ec538c5874fc3996d37d0 /roundcubemail/program/include
parent2d53dc92ba1a7aebfa053e2f1c3d4cdb01b45d46 (diff)
- Support/Require tls:// prefix in 'smtp_server' option for TLS connections
- "Split" config file into sections git-svn-id: https://svn.roundcube.net/trunk@3324 208e9e7b-5314-0410-a742-e7e81cd9613c
Diffstat (limited to 'roundcubemail/program/include')
-rw-r--r--roundcubemail/program/include/rcube_smtp.php11
1 files changed, 9 insertions, 2 deletions
diff --git a/roundcubemail/program/include/rcube_smtp.php b/roundcubemail/program/include/rcube_smtp.php
index 299126267..2bf8cc1e0 100644
--- a/roundcubemail/program/include/rcube_smtp.php
+++ b/roundcubemail/program/include/rcube_smtp.php
@@ -82,6 +82,12 @@ class rcube_smtp {
if (isset($smtp_host_url['host']) && isset($smtp_host_url['scheme']))
$smtp_host = sprintf('%s://%s', $smtp_host_url['scheme'], $smtp_host_url['host']);
+ // remove TLS prefix and set flag for use in Net_SMTP::auth()
+ if (preg_match('#^tls://#i', $smtp_host)) {
+ $smtp_host = preg_replace('#^tls://#i', '', $smtp_host);
+ $use_tls = true;
+ }
+
if (!empty($CONFIG['smtp_helo_host']))
$helo_host = $CONFIG['smtp_helo_host'];
else if (!empty($_SERVER['SERVER_NAME']))
@@ -107,11 +113,12 @@ class rcube_smtp {
$smtp_user = str_replace('%u', $_SESSION['username'], $CONFIG['smtp_user']);
$smtp_pass = str_replace('%p', $RCMAIL->decrypt($_SESSION['password']), $CONFIG['smtp_pass']);
$smtp_auth_type = empty($CONFIG['smtp_auth_type']) ? NULL : $CONFIG['smtp_auth_type'];
-
+
// attempt to authenticate to the SMTP server
if ($smtp_user && $smtp_pass)
{
- $result = $this->conn->auth($smtp_user, $smtp_pass, $smtp_auth_type);
+ $result = $this->conn->auth($smtp_user, $smtp_pass, $smtp_auth_type, $use_tls);
+
if (PEAR::isError($result))
{
$this->error = array('label' => 'smtpautherror', 'vars' => array('code' => $this->conn->_code));