re: r93415
authorMark A. Hershberger <mah@users.mediawiki.org>
Tue, 2 Aug 2011 19:35:01 +0000 (19:35 +0000)
committerMark A. Hershberger <mah@users.mediawiki.org>
Tue, 2 Aug 2011 19:35:01 +0000 (19:35 +0000)
* 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
includes/UserMailer.php

index 7e4eb0a..6b8bf40 100644 (file)
@@ -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
index b3951ae..164b8ba 100644 (file)
@@ -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 );
                }