Manual:Hooks/UserMailerTransformContent

From Linux Web Expert

UserMailerTransformContent
<translate> Available from <tvar name=1><translate> version <tvar (Gerrit change 242791)</tvar></translate>
Allow transformation of content, such as encrypting/signing
<translate> Define function:</translate>
public static function onUserMailerTransformContent( array $to, MailAddress $from, &$body, &$error ) { ... }
<translate> Attach hook:</translate> <translate> In <tvar name=1>extension.json</tvar>:</translate>
{
	"Hooks": {
		"UserMailerTransformContent": "MediaWiki\\Extension\\MyExtension\\Hooks::onUserMailerTransformContent"
	}
}
<translate> Called from:</translate> <translate> File(s):</translate> UserMailer.php
<translate> Interface:</translate> UserMailerTransformContentHook.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:UserMailerTransformContent extensions</tvar>.</translate>


If returning false, the mail is not sent.

Details

  • $to: array of MailAdress objects of the targets
  • $from: MailAddress of the sender
  • &$body: email body, either a string (for plaintext emails) or an array with 'text' and 'html' keys
  • &$error: should be set to an error message string, by default false

See also