MediaWiki master
MediaWiki\Mail\Emailer Class Reference

Send arbitrary emails. More...

Inherits MediaWiki\Mail\IEmailer.

Collaboration diagram for MediaWiki\Mail\Emailer:

Public Member Functions

 send ( $to, MailAddress $from, string $subject, string $bodyText, ?string $bodyHtml=null, array $options=[])

Detailed Description

Send arbitrary emails.

Obtain instance via ServiceWiring. This service is intended to eventually replace the stable (but static) functions of the UserMailer class.

Use of this class is discouraged in favour of higher-level abstractions whenever possible:

  • EmailNotification: Format and send emails to watchers about a recent change.
  • EmailUserFactory: Format and send emails between two wiki users.

Definition at line 42 of file Emailer.php.

Member Function Documentation

◆ send()

MediaWiki\Mail\Emailer::send ( $to,
MailAddress $from,
string $subject,
string $bodyText,
?string $bodyHtml = null,
array $options = [] )

This function will perform a direct (authenticated) login to a SMTP Server to use for mail relaying if 'wgSMTP' specifies an array of parameters. It requires PEAR:Mail to do that. Otherwise it just uses the standard PHP 'mail' function.

Sends emails to recipients.

MailAddress | MailAddress[]$toArray of Recipients' emails
MailAddress$fromSender's email
string$subjectEmail's subject.
string$bodyTexttext part of body
string | null$bodyHtmlhtml part of body (optional)
array$optionsKeys: 'replyTo' MailAddress 'contentType' string default 'text/plain; charset=UTF-8' 'headers' array Extra headers to set

Implements MediaWiki\Mail\IEmailer.

Definition at line 54 of file Emailer.php.

The documentation for this class was generated from the following file: