Available from version 1.27.0 (Gerrit change 242791)
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.
Define function:
public static function onUserMailerTransformMessage( array $to, MailAddress $from, &$subject, &$headers, &$body, &$error ) { ... }
Attach hook:

In extension.json:

	"Hooks": {
		"UserMailerTransformMessage": "MyExtensionHooks::onUserMailerTransformMessage"
Called from:File(s): UserMailer.php
Function(s): sendInternal

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


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