MediaWiki  master
EmaillingJob.php
Go to the documentation of this file.
1 <?php
28 class EmaillingJob extends Job {
29  public function __construct( ?Title $title, array $params ) {
30  parent::__construct( 'sendMail', Title::newMainPage(), $params );
31  }
32 
33  public function run() {
34  $status = UserMailer::send(
35  $this->params['to'],
36  $this->params['from'],
37  $this->params['subj'],
38  $this->params['body'],
39  [ 'replyTo' => $this->params['replyto'] ]
40  );
41 
42  return $status->isOK();
43  }
44 }
Send an arbitrary single email.
__construct(?Title $title, array $params)
run()
Run the job.
Class to both describe a background job and handle jobs.
Definition: Job.php:39
Title $title
Definition: Job.php:50
array $params
Array of job parameters.
Definition: Job.php:44
Represents a title within MediaWiki.
Definition: Title.php:52
static newMainPage(MessageLocalizer $localizer=null)
Create a new Title for the Main Page.
Definition: Title.php:703
static send( $to, $from, $subject, $body, $options=[])
This function will perform a direct (authenticated) login to a SMTP Server to use for mail relaying i...
Definition: UserMailer.php:98