diff options
author | alecpl <alec@alec.pl> | 2011-11-24 10:54:59 +0000 |
---|---|---|
committer | alecpl <alec@alec.pl> | 2011-11-24 10:54:59 +0000 |
commit | 3875eb68139d878fba2f00bdcaae3c34ebb53da7 (patch) | |
tree | c4e8e20d5795b53c7bbb740025d0d9af85750405 /program/include/rcube_smtp.php | |
parent | f4cfb1414ad85b70977fb83989ad906e061827bd (diff) |
- Add possibility to add SASL mechanisms for SMTP in smtp_connect hook (#1487937)
Diffstat (limited to 'program/include/rcube_smtp.php')
-rw-r--r-- | program/include/rcube_smtp.php | 15 |
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); |