Manual:Hooks/UserMailerTransformMessage

From Linux Web Expert

UserMailerTransformMessage
<translate> Available from <tvar name=1><translate> version <tvar (Gerrit change 242791)</tvar></translate>
Called in UserMailer::send() to change email after it has gone through the MIME transform. Extensions can block sending the email by returning false and setting $error.
<translate> Define function:</translate>
public static function onUserMailerTransformMessage( array $to, MailAddress $from, &$subject, &$headers, &$body, &$error ) { ... }
<translate> Attach hook:</translate> <translate> In <tvar name=1>extension.json</tvar>:</translate>
{
	"Hooks": {
		"UserMailerTransformMessage": "MediaWiki\\Extension\\MyExtension\\Hooks::onUserMailerTransformMessage"
	}
}
<translate> Called from:</translate> <translate> File(s):</translate> UserMailer.php
<translate> Function(s):</translate> sendInternal
<translate> Interface:</translate> UserMailerTransformMessageHook.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:UserMailerTransformMessage extensions</tvar>.</translate>


Details

  • $to: array of MailAddress objects of the targets
  • $from: MailAddress of the sender
  • &$subject: email subject (not MIME encoded)
  • &$headers: email headers (except To: and Subject:) as an array of header name => value pairs
  • &$body: email body (in MIME format) as a string
  • &$error: should be set to an error message string, by default false