From 8e9deef3c42970c445a79264ead08c2e6ab17614 Mon Sep 17 00:00:00 2001 From: "Mark A. Hershberger" Date: Tue, 2 Aug 2011 19:35:01 +0000 Subject: [PATCH] re: r93415 * Document what happens as the result of each value returned * Require boolean true to continue, not just a true value or strings would succeed * Trim the arguments since the header array already contains them. --- docs/hooks.txt | 5 ++++- includes/UserMailer.php | 4 ++-- 2 files changed, 6 insertions(+), 3 deletions(-) diff --git a/docs/hooks.txt b/docs/hooks.txt index 7e4eb0a1d7..6b8bf40815 100644 --- a/docs/hooks.txt +++ b/docs/hooks.txt @@ -296,7 +296,10 @@ 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 +be logged (or something else) instead of using PEAR or PHP's mail(). +Return false to skip the regular method of sending mail. Return a +string to return a php-mail-error message containing the error. +Returning true will continue with sending email in the regular way. $headers: Associative array of headers for the email $to: MailAddress object or array $from: From address diff --git a/includes/UserMailer.php b/includes/UserMailer.php index b3951aec16..164b8ba4bd 100644 --- a/includes/UserMailer.php +++ b/includes/UserMailer.php @@ -192,10 +192,10 @@ class UserMailer { $headers['X-Mailer'] = 'MediaWiki mailer'; $headers['From'] = $from->toString(); - $ret = wfRunHooks( 'AlternateUserMailer', array( $headers, $to, $from, $subject, $body, $replyto, $contentType ) ); + $ret = wfRunHooks( 'AlternateUserMailer', array( $headers, $to, $from, $subject, $body ) ); if ( $ret === false ) { return Status::newGood(); - } else if ( $ret != true ) { + } else if ( $ret !== true ) { return Status::newFatal( 'php-mail-error', $ret ); } -- 2.20.1