MediaWiki master
EmaillingJob.php
Go to the documentation of this file.
1<?php
24
32class EmaillingJob extends Job {
33
35 private $emailer;
36
37 public function __construct( ?Title $title, array $params, IEmailer $emailer ) {
38 parent::__construct( 'sendMail', Title::newMainPage(), $params );
39 $this->emailer = $emailer;
40 }
41
42 public function run() {
43 $status = $this->emailer->send(
44 [ $this->params['to'] ],
45 $this->params['from'],
46 $this->params['subj'],
47 $this->params['body'],
48 null,
49 [ 'replyTo' => $this->params['replyto'] ]
50 );
51
52 return $status->isOK();
53 }
54}
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:41
Represents a title within MediaWiki.
Definition Title.php:78
Interface for sending arbitrary emails.
Definition IEmailer.php:35