37 $this->options->assertRequiredOptions( self::CONSTRUCTOR_OPTIONS );
40 private function buildEmailByType(
44 $builder = $this->confirmEmailBuilderFactory->newFromContext( $ctx );
45 return match ( $type ) {
46 self::EMAIL_TYPE_CREATED => $builder->buildEmailCreated( $data ),
47 self::EMAIL_TYPE_CHANGED => $builder->buildEmailChanged( $data ),
48 self::EMAIL_TYPE_SET => $builder->buildEmailSet( $data ),
49 default =>
throw new LogicException(
50 '$type "' . $type .
'" is not any of the supported types'
62 private function sendEmailToRecipient(
63 MessageLocalizer $localizer,
65 ConfirmEmailContent $emailContent
67 $sender = new MailAddress(
69 $localizer->msg(
'emailsender' )->inContentLanguage()->text()
72 return $this->emailer->send(
75 $emailContent->getSubject(),
76 $emailContent->getPlaintext(),
77 $emailContent->getHtml()
93 $emailContent = $this->buildEmailByType( $ctx, $type, $data );
94 $recipientUser = $this->userFactory->newFromUserIdentity( $data->
getRecipientUser() );
96 $emailAsArray = $emailContent->toArray();
97 $this->hookRunner->onUserSendConfirmationMail(
108 $emailContent = ConfirmEmailContent::newFromArray( $emailAsArray );
110 return $this->sendEmailToRecipient( $ctx, $recipientUser, $emailContent );
Value class defining an email sent to the user.
A class containing constants representing the names of configuration variables.
const PasswordSender
Name constant for the PasswordSender setting, for use with Config::get()
Generic operation result class Has warning/error list, boolean status and arbitrary value.
Interface for objects which can provide a MediaWiki context on request.