MediaWiki master
MediaWiki\Mail\EmailUser Class Reference

Send email between two wiki users. More...

Public Member Functions

 __construct (private readonly ServiceOptions $options, HookContainer $hookContainer, private readonly UserOptionsLookup $userOptionsLookup, private readonly CentralIdLookup $centralIdLookup, private readonly UserFactory $userFactory, private readonly IEmailer $emailer, private readonly IMessageFormatterFactory $messageFormatterFactory, private readonly ITextFormatter $contLangMsgFormatter, private readonly Authority $sender,)
 
 authorizeSend ()
 Authorize the email sending, checking permissions etc.
 
 canSend ()
 Checks whether email sending is allowed.
 
 sendEmailUnsafe (UserEmailContact $target, string $subject, string $text, bool $CCMe, string $langCode)
 Really send a mail, without permission checks.
 
 setEditToken (string $token)
 
 validateTarget (UserEmailContact $target)
 

Public Attributes

const array CONSTRUCTOR_OPTIONS
 

Detailed Description

Send email between two wiki users.

Obtain via EmailUserFactory

This class is stateless and can be used for multiple sends.

Since
1.40

Definition at line 37 of file EmailUser.php.

Constructor & Destructor Documentation

◆ __construct()

MediaWiki\Mail\EmailUser::__construct ( private readonly ServiceOptions $options,
HookContainer $hookContainer,
private readonly UserOptionsLookup $userOptionsLookup,
private readonly CentralIdLookup $centralIdLookup,
private readonly UserFactory $userFactory,
private readonly IEmailer $emailer,
private readonly IMessageFormatterFactory $messageFormatterFactory,
private readonly ITextFormatter $contLangMsgFormatter,
private readonly Authority $sender )
Access: internal
For use by EmailUserFactory.

Definition at line 56 of file EmailUser.php.

Member Function Documentation

◆ authorizeSend()

MediaWiki\Mail\EmailUser::authorizeSend ( )

Authorize the email sending, checking permissions etc.

Returns
StatusValue For BC, the StatusValue's value can be set to a string representing a message key to use with ErrorPageError. Only SpecialEmailUser should rely on this.

Definition at line 164 of file EmailUser.php.

◆ canSend()

MediaWiki\Mail\EmailUser::canSend ( )

Checks whether email sending is allowed.

Returns
StatusValue For BC, the StatusValue's value can be set to a string representing a message key to use with ErrorPageError. Only SpecialEmailUser should rely on this.

Definition at line 121 of file EmailUser.php.

◆ sendEmailUnsafe()

MediaWiki\Mail\EmailUser::sendEmailUnsafe ( UserEmailContact $target,
string $subject,
string $text,
bool $CCMe,
string $langCode )

Really send a mail, without permission checks.

Parameters
UserEmailContact$target
string$subject
string$text
bool$CCMe
string$langCodeCode of the language to be used for interface messages
Returns
StatusValue

Definition at line 193 of file EmailUser.php.

◆ setEditToken()

MediaWiki\Mail\EmailUser::setEditToken ( string $token)
Access: internal
Only for BC with SpecialEmailUser

Definition at line 376 of file EmailUser.php.

◆ validateTarget()

MediaWiki\Mail\EmailUser::validateTarget ( UserEmailContact $target)
Access: internal
Todo
This method might perhaps be moved to a UserEmailContactLookup or something.

Definition at line 75 of file EmailUser.php.

Member Data Documentation

◆ CONSTRUCTOR_OPTIONS

const array MediaWiki\Mail\EmailUser::CONSTRUCTOR_OPTIONS
Initial value:
= [
]
const EnableUserEmail
Name constant for the EnableUserEmail setting, for use with Config::get()
const EnableEmail
Name constant for the EnableEmail setting, for use with Config::get()
const PasswordSender
Name constant for the PasswordSender setting, for use with Config::get()
const UserEmailUseReplyTo
Name constant for the UserEmailUseReplyTo setting, for use with Config::get()
Access: internal
For use by ServiceWiring

Definition at line 41 of file EmailUser.php.

Referenced by MediaWiki\Mail\EmailUserFactory\__construct().


The documentation for this class was generated from the following file: