From e5a99a4262778dc3add1346e4d2bd6971e330807 Mon Sep 17 00:00:00 2001 From: "Mark A. Hershberger" Date: Thu, 28 Jul 2011 19:19:42 +0000 Subject: [PATCH] =?utf8?q?Add=20hook=20that=20could=20be=20the=20solution?= =?utf8?q?=20for=20Bug=20#28026=20(=E2=80=9CEnable=20e-mail=20notification?= =?utf8?q?s=20for=20watchlist=20(EnotifWatchlist)=20on=20all=20small=20wik?= =?utf8?q?is=E2=80=9D)=20to=20make=20logging=20sent=20emails=20easier.?= MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit --- docs/hooks.txt | 9 +++++++++ includes/UserMailer.php | 7 +++++++ 2 files changed, 16 insertions(+) diff --git a/docs/hooks.txt b/docs/hooks.txt index bf4a46e430..abe40a7b73 100644 --- a/docs/hooks.txt +++ b/docs/hooks.txt @@ -295,6 +295,15 @@ before showing the edit form ( EditPage::edit() ). This is triggered on &action=edit. $EditPage: the EditPage object +'AlternateUserMailer': Called before mail is sent so that mail could +be logged (or something else) instead of using PEAR or SMTP +$UserMailer: the EditPage object +$headers: Associative array of headers for the email +$to: MailAddress object or array +$from: From address +$subject: Subject of the email +$body: Body of the message + 'APIAfterExecute': after calling the execute() method of an API module. Use this to extend core API modules. &$module: Module object diff --git a/includes/UserMailer.php b/includes/UserMailer.php index 1bb7c08875..1009337132 100644 --- a/includes/UserMailer.php +++ b/includes/UserMailer.php @@ -180,6 +180,13 @@ class UserMailer { $headers['X-Mailer'] = 'MediaWiki mailer'; $headers['From'] = $from->toString(); + $ret = wfRunHooks( 'AlternateUserMailer', array( $this, $headers, $to, $from, $subject, $body, $replyto, $contentType ) ) ) { + if ( $ret === false ) { + return Status::newGood(); + } else if ( $ret != true ) { + return Status::newFatal( 'php-mail-error', $ret ); + } + if ( is_array( $wgSMTP ) ) { if ( function_exists( 'stream_resolve_include_path' ) ) { $found = stream_resolve_include_path( 'Mail.php' ); -- 2.20.1