Manual:Hooks/UserSendConfirmationMail

From Linux Web Expert

The printable version is no longer supported and may have rendering errors. Please update your browser bookmarks and please use the default browser print function instead.
UserSendConfirmationMail
<translate> Available from <tvar name=1><translate> version <tvar (Gerrit change 493143)</tvar></translate>
Called just before a confirmation email is sent to a user. Hook handlers can modify the email that will be sent.
<translate> Define function:</translate>
public static function onUserSendConfirmationMail( User $user, array &$mail, array $info ) { ... }
<translate> Attach hook:</translate> <translate> In <tvar name=1>extension.json</tvar>:</translate>
{
	"Hooks": {
		"UserSendConfirmationMail": "MediaWiki\\Extension\\MyExtension\\Hooks::onUserSendConfirmationMail"
	}
}
<translate> Called from:</translate> <translate> File(s):</translate> user/User.php
<translate> Function(s):</translate> sendConfirmationMail
<translate> Interface:</translate> UserSendConfirmationMailHook.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:UserSendConfirmationMail extensions</tvar>.</translate>


Details

  • $user: The User object for which the confirmation email is going to be sent
  • &$mail: Associative array describing the email, with the following keys
    • subject: Subject line of the email
    • body: Email body. Can be a string, or an array with keys 'text' and 'html'
    • from: User object, or null meaning $wgPasswordSender will be used
    • replyTo: MailAddress object or null
  • $info: Associative array with additional information
    • type: 'created' if the user's account was just created; 'set' if the user set an email address when they previously didn't have one; 'changed' if the user had an email address and changed it
    • ip: The IP address from which the user set/changed their email address
    • confirmURL: URL the user should visit to confirm their email
    • invalidateURL: URL the user should visit to invalidate confirmURL
    • expiration: time and date when confirmURL expires