From 51a86983b66918c1b6068d3670dcd6f6a71abf49 Mon Sep 17 00:00:00 2001 From: pdontthink Date: Sat, 2 Apr 2011 19:19:45 +0000 Subject: [PATCH] Add smtp_auth hook (thanks to Emmanuel Dreyfus) git-svn-id: https://svn.code.sf.net/p/squirrelmail/code/trunk/squirrelmail@14094 7612ce4b-ef26-0410-bec9-ea0150e637f0 --- class/deliver/Deliver_SMTP.class.php | 14 +++++++++++++- doc/ChangeLog | 1 + 2 files changed, 14 insertions(+), 1 deletion(-) diff --git a/class/deliver/Deliver_SMTP.class.php b/class/deliver/Deliver_SMTP.class.php index 91b52644..ac3db6a7 100644 --- a/class/deliver/Deliver_SMTP.class.php +++ b/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"); diff --git a/doc/ChangeLog b/doc/ChangeLog index 23300a5b..98241eac 100644 --- a/doc/ChangeLog +++ b/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) -------------------------------------- -- 2.25.1