MediaWiki 1.42.0
EmaillingJob.php
Go to the documentation of this file.
1<?php
23
31class EmaillingJob extends Job {
32
34 private $emailer;
35
36 public function __construct( ?Title $title, array $params, IEmailer $emailer ) {
37 parent::__construct( 'sendMail', Title::newMainPage(), $params );
38 $this->emailer = $emailer;
39 }
40
41 public function run() {
42 $status = $this->emailer->send(
43 [ $this->params['to'] ],
44 $this->params['from'],
45 $this->params['subj'],
46 $this->params['body'],
47 null,
48 [ 'replyTo' => $this->params['replyto'] ]
49 );
50
51 return $status->isOK();
52 }
53}
array $params
The job parameters.
Send an arbitrary single email.
run()
Run the job.
__construct(?Title $title, array $params, IEmailer $emailer)
Describe and execute a background job.
Definition Job.php:40
Represents a title within MediaWiki.
Definition Title.php:78
Interface for sending emails.
Definition IEmailer.php:32