MediaWiki master
EmaillingJob.php
Go to the documentation of this file.
1<?php
7namespace MediaWiki\Mail;
8
11
19class EmaillingJob extends Job {
20
22 private $emailer;
23
24 public function __construct( ?Title $title, array $params, IEmailer $emailer ) {
25 parent::__construct( 'sendMail', Title::newMainPage(), $params );
26 $this->emailer = $emailer;
27 }
28
30 public function run() {
31 $status = $this->emailer->send(
32 [ $this->params['to'] ],
33 $this->params['from'],
34 $this->params['subj'],
35 $this->params['body'],
36 null,
37 [ 'replyTo' => $this->params['replyto'] ]
38 );
39
40 return $status->isOK();
41 }
42}
43
45class_alias( EmaillingJob::class, 'EmaillingJob' );
Describe and execute a background job.
Definition Job.php:28
array $params
Array of job parameters.
Definition Job.php:33
Send an arbitrary single email.
run()
Run the job.If this method returns false or completes exceptionally, the job runner will retry execut...
__construct(?Title $title, array $params, IEmailer $emailer)
Represents a title within MediaWiki.
Definition Title.php:69
Interface for sending arbitrary emails.
Definition IEmailer.php:20