MediaWiki master
MediaWiki\Mail\EmailUser Class Reference

Command for sending emails to users. More...

Public Member Functions

 __construct (ServiceOptions $options, HookContainer $hookContainer, UserOptionsLookup $userOptionsLookup, CentralIdLookup $centralIdLookup, UserFactory $userFactory, IEmailer $emailer, IMessageFormatterFactory $messageFormatterFactory, ITextFormatter $contLangMsgFormatter, 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 CONSTRUCTOR_OPTIONS
 

Detailed Description

Command for sending emails to users.

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

Since
1.40

Definition at line 47 of file EmailUser.php.

Constructor & Destructor Documentation

◆ __construct()

MediaWiki\Mail\EmailUser::__construct ( ServiceOptions  $options,
HookContainer  $hookContainer,
UserOptionsLookup  $userOptionsLookup,
CentralIdLookup  $centralIdLookup,
UserFactory  $userFactory,
IEmailer  $emailer,
IMessageFormatterFactory  $messageFormatterFactory,
ITextFormatter  $contLangMsgFormatter,
Authority  $sender 
)
Parameters
ServiceOptions$options
HookContainer$hookContainer
UserOptionsLookup$userOptionsLookup
CentralIdLookup$centralIdLookup
UserFactory$userFactory
IEmailer$emailer
IMessageFormatterFactory$messageFormatterFactory
ITextFormatter$contLangMsgFormatter
Authority$sender

Definition at line 91 of file EmailUser.php.

References MediaWiki\Config\ServiceOptions\assertRequiredOptions().

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 211 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 168 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 240 of file EmailUser.php.

◆ setEditToken()

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

Definition at line 428 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.
Parameters
UserEmailContact$targetTarget user
Returns
StatusValue

Definition at line 122 of file EmailUser.php.

Member Data Documentation

◆ CONSTRUCTOR_OPTIONS

const MediaWiki\Mail\EmailUser::CONSTRUCTOR_OPTIONS
Initial value:
= [
]
const EnableUserEmail
Name constant for the EnableUserEmail setting, for use with Config::get()
const EnableSpecialMute
Name constant for the EnableSpecialMute 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 51 of file EmailUser.php.

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


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