summaryrefslogtreecommitdiff
path: root/program/include
diff options
context:
space:
mode:
Diffstat (limited to 'program/include')
-rw-r--r--program/include/rcube_smtp.php15
1 files changed, 12 insertions, 3 deletions
diff --git a/program/include/rcube_smtp.php b/program/include/rcube_smtp.php
index 5c2dd92d2..e1a6f3af0 100644
--- a/program/include/rcube_smtp.php
+++ b/program/include/rcube_smtp.php
@@ -50,13 +50,13 @@ class rcube_smtp
public function connect($host=null, $port=null, $user=null, $pass=null)
{
$RCMAIL = rcmail::get_instance();
-
+
// disconnect/destroy $this->conn
$this->disconnect();
-
+
// reset error/response var
$this->error = $this->response = null;
-
+
// let plugins alter smtp connection config
$CONFIG = $RCMAIL->plugins->exec_hook('smtp_connect', array(
'smtp_server' => $host ? $host : $RCMAIL->config->get('smtp_server'),
@@ -68,6 +68,7 @@ class rcube_smtp
'smtp_auth_type' => $RCMAIL->config->get('smtp_auth_type'),
'smtp_helo_host' => $RCMAIL->config->get('smtp_helo_host'),
'smtp_timeout' => $RCMAIL->config->get('smtp_timeout'),
+ 'smtp_auth_callbacks' => array(),
));
$smtp_host = rcube_parse_host($CONFIG['smtp_server']);
@@ -108,6 +109,14 @@ class rcube_smtp
if ($RCMAIL->config->get('smtp_debug'))
$this->conn->setDebug(true, array($this, 'debug_handler'));
+ // register authentication methods
+ if (!empty($CONFIG['smtp_auth_callbacks']) && method_exists($this->conn, 'setAuthMethod')) {
+ foreach ($CONFIG['smtp_auth_callbacks'] as $callback) {
+ $this->conn->setAuthMethod($callback['name'], $callback['function'],
+ isset($callback['prepend']) ? $callback['prepend'] : true);
+ }
+ }
+
// try to connect to server and exit on failure
$result = $this->conn->connect($smtp_timeout);