Go to the documentation of this file.
34 if ( !( $targetUser instanceof
User ) ) {
35 switch ( $targetUser ) {
43 $this->
dieWithError( [
'apierror-unknownerror', $targetUser ] );
58 'Target' => $targetUser->getName(),
59 'Text' => $params[
'text'],
60 'Subject' => $params[
'subject'],
61 'CCMe' => $params[
'ccme'],
64 if ( !$retval instanceof
Status ) {
69 $result = array_filter( [
70 'result' => $retval->isGood() ?
'Success' : ( $retval->isOK() ?
'Warnings' :
'Failure' ),
107 'action=emailuser&target=WikiSysop&text=Content&token=123ABC'
108 =>
'apihelp-emailuser-example-email',
113 return 'https://www.mediawiki.org/wiki/Special:MyLanguage/API:Email';
getExamplesMessages()
Returns usage examples for this module.
getContext()
Get the base IContextSource object.
static newFatal( $message,... $parameters)
Factory function for fatal errors.
const PARAM_REQUIRED
(boolean) Is the parameter required?
dieWithError( $msg, $code=null, $data=null, $httpCode=null)
Abort execution with an error.
const PARAM_TYPE
(string|string[]) Either an array of allowed value strings, or a string type as described below.
getResult()
Get the result object.
mustBePosted()
Indicates whether this module must be called with a POST request.
static getTarget( $target, User $sender)
Validate target User.
This abstract class implements many basic API functions, and is the base of all API classes.
Generic operation result class Has warning/error list, boolean status and arbitrary value.
getAllowedParams()
Returns an array of allowed parameters (parameter name) => (default value) or (parameter name) => (ar...
extractRequestParams( $options=[])
Using getAllowedParams(), this function makes an array of the values provided by the user,...
API Module to facilitate sending of emails to users.
execute()
Evaluates the parameters, performs the requested query, and sets up the result.
static getPermissionsError( $user, $editToken, Config $config=null)
Check whether a user is allowed to send email.
static submit(array $data, IContextSource $context)
Really send a mail.
getModuleName()
Get the name of the module being executed by this instance.
isWriteMode()
Indicates whether this module requires write mode.
getHelpUrls()
Return links to more detailed help pages about the module.
The User object encapsulates all of the user-specific settings (user_id, name, rights,...
getErrorFormatter()
Get the error formatter.
needsToken()
Returns the token type this module requires in order to execute.