Manual:Hooks/UserMailerTransformContent

From MediaWiki.org
Jump to navigation Jump to search
UserMailerTransformContent
Available from version 1.27.0 (Gerrit change 242791)
Allow transformation of content, such as encrypting/signing
Define function:
public static function onUserMailerTransformContent( array $to, MailAddress $from, &$body, &$error ) { ... }
Attach hook:

In extension.json:

{
	"Hooks": {
		"UserMailerTransformContent": "MyExtensionHooks::onUserMailerTransformContent"
	}
}

For MediaWiki ≤1.25:

$wgHooks['UserMailerTransformContent'][] = 'MyExtensionHooks::onUserMailerTransformContent';
Called from:File(s): UserMailer.php

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

If returning false, the mail is not sent.

Details[edit]

  • $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[edit]