Explorar el Código

Add smtp_auth hook (thanks to Emmanuel Dreyfus)

pdontthink hace 14 años
padre
commit
eee0c34977
Se han modificado 2 ficheros con 14 adiciones y 1 borrados
  1. 13 1
      class/deliver/Deliver_SMTP.class.php
  2. 1 0
      doc/ChangeLog

+ 13 - 1
class/deliver/Deliver_SMTP.class.php

@@ -210,7 +210,19 @@ class Deliver_SMTP extends Deliver {
         }
 
         // FIXME: check ehlo response before using authentication
-        if (( $smtp_auth_mech == 'cram-md5') or ( $smtp_auth_mech == 'digest-md5' )) {
+
+        // Try authentication by a plugin
+        $smtp_auth_args = array(
+            'auth_mech' => $smtp_auth_mech,
+            'user' => $user,
+            'pass' => $pass,
+            'host' => $host,
+            'port' => $port,
+            'stream' => $stream,
+        );
+        if (boolean_hook_function('smtp_auth', $smtp_auth_args, 1)) {
+            // authentication succeeded
+        } else if (( $smtp_auth_mech == 'cram-md5') or ( $smtp_auth_mech == 'digest-md5' )) {
             // Doing some form of non-plain auth
             if ($smtp_auth_mech == 'cram-md5') {
                 fputs($stream, "AUTH CRAM-MD5\r\n");

+ 1 - 0
doc/ChangeLog

@@ -356,6 +356,7 @@ Version 1.5.2 - SVN
   - Forced addition of a file suffix to attachments that lack a filename
     (helps forwarded messages avoid spam filters) (Thanks to Petr
     Kletecka) (#3139004).
+  - Added smtp_auth hook (Thanks to Emmanuel Dreyfus).
 
 Version 1.5.1 (branched on 2006-02-12)
 --------------------------------------