Manual:Hooks/AlternateUserMailer

From Linux Web Expert

AlternateUserMailer
<translate> Available from <tvar name=1><translate> version <tvar (r93415, codereview)</tvar></translate>
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.
<translate> Define function:</translate>
public static function onAlternateUserMailer( $headers, $to, $from, $subject, $body ) { ... }
<translate> Attach hook:</translate> <translate> In <tvar name=1>extension.json</tvar>:</translate>
{
	"Hooks": {
		"AlternateUserMailer": "MediaWiki\\Extension\\MyExtension\\Hooks::onAlternateUserMailer"
	}
}
<translate> Called from:</translate> <translate> File(s):</translate> mail/UserMailer.php
<translate> Interface:</translate> AlternateUserMailerHook.php

<translate> For more information about attaching hooks, see <tvar name=1>Manual:Hooks </tvar>.</translate>
<translate> For examples of extensions using this hook, see <tvar name=cat>Category:AlternateUserMailer extensions</tvar>.</translate>


Details

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