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.
This commit is contained in:
Mark A. Hershberger 2011-08-02 19:35:01 +00:00
parent 93075f0af3
commit 8e9deef3c4
2 changed files with 6 additions and 3 deletions

View 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

View 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 );
}