Manual:Hooks/AlternateUserMailer

From mediawiki.org
AlternateUserMailer
Available from version 1.19.0 (r93415, codereview)
Called before mail is sent, so that mail could 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.
Define function:
public static function onAlternateUserMailer( $headers, $to, $from, $subject, $body ) { ... }
Attach hook: In extension.json:
{
	"Hooks": {
		"AlternateUserMailer": "MediaWiki\\Extension\\MyExtension\\Hooks::onAlternateUserMailer"
	}
}
Called from: File(s): mail/UserMailer.php
Interface: AlternateUserMailerHook.php

For more information about attaching hooks, see Manual:Hooks .
For examples of extensions using this hook, see Category:AlternateUserMailer extensions.


Details[edit]

  • $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