MediaWiki master
UserMailer Class Reference

Collection of static functions for sending mail. More...

Static Public Member Functions

static quotedPrintable ( $string, $charset='')
 Converts a string into quoted-printable format.
 
static rfc822Phrase ( $phrase)
 Converts a string into a valid RFC 822 "phrase", such as is used for the sender name.
 
static sanitizeHeaderValue ( $val)
 Strips bad characters from a header value to prevent PHP mail header injection attacks.
 
static send ( $to, $from, $subject, $body, $options=[])
 Send a raw email via SMTP (if $wgSMTP is set) or otherwise via PHP mail().
 

Static Protected Member Functions

static sendInternal (array $to, MailAddress $from, $subject, $body, $options=[])
 Helper function fo UserMailer::send() which does the actual sending.
 
static sendWithPear ( $mailer, $dest, $headers, $body)
 Send mail using a PEAR mailer.
 

Detailed Description

Collection of static functions for sending mail.

Since
1.12

Definition at line 44 of file UserMailer.php.

Member Function Documentation

◆ quotedPrintable()

static UserMailer::quotedPrintable ( $string,
$charset = '' )
static

Converts a string into quoted-printable format.

Since
1.17

From PHP5.3 there is a built in function quoted_printable_encode() This method does not duplicate that. This method is doing Q encoding inside encoded-words as defined by RFC 2047 This is for email headers. The built in quoted_printable_encode() is for email bodies

Parameters
string$string
string$charset
Returns
string

Definition at line 483 of file UserMailer.php.

◆ rfc822Phrase()

static UserMailer::rfc822Phrase ( $phrase)
static

Converts a string into a valid RFC 822 "phrase", such as is used for the sender name.

Deprecated
since 1.38; This method has not been used by anything
Parameters
string$phrase
Returns
string

Definition at line 461 of file UserMailer.php.

References wfDeprecated().

◆ sanitizeHeaderValue()

static UserMailer::sanitizeHeaderValue ( $val)
static

Strips bad characters from a header value to prevent PHP mail header injection attacks.

Parameters
string$valString to be sanitized
Returns
string

Definition at line 451 of file UserMailer.php.

◆ send()

static UserMailer::send ( $to,
$from,
$subject,
$body,
$options = [] )
static

Send a raw email via SMTP (if $wgSMTP is set) or otherwise via PHP mail().

This function perform a direct (authenticated) login to a SMTP server, to use for mail relaying, if 'wgSMTP' specifies an array of parameters. This uses the pear/mail package.

Otherwise it uses the standard PHP 'mail' function, which in turn relies on the server's sendmail configuration.

Since
1.12
Parameters
MailAddress | MailAddress[]$toRecipient's email (or an array of them)
MailAddress$fromSender's email
string$subjectEmail's subject.
string | string[]$bodyEmail's text or Array of two strings to be the text and html bodies
array$optionsKeys: 'replyTo' MailAddress 'contentType' string default 'text/plain; charset=UTF-8' 'headers' array Extra headers to set
Returns
Status

Definition at line 111 of file UserMailer.php.

References wfDebug().

◆ sendInternal()

static UserMailer::sendInternal ( array $to,
MailAddress $from,
$subject,
$body,
$options = [] )
staticprotected

Helper function fo UserMailer::send() which does the actual sending.

It expects a $to list which the UserMailerSplitTo hook would not split further.

Parameters
MailAddress[]$toArray of recipients' email addresses
MailAddress$fromSender's email
string$subjectEmail's subject.
string | string[]$bodyEmail's text or Array of two strings to be the text and html bodies
array$optionsKeys: 'replyTo' MailAddress 'contentType' string default 'text/plain; charset=UTF-8' 'headers' array Extra headers to set
Returns
Status

Definition at line 204 of file UserMailer.php.

References PROTO_CANONICAL, MailAddress\toString(), wfDebug(), and wfIsWindows().

◆ sendWithPear()

static UserMailer::sendWithPear ( $mailer,
$dest,
$headers,
$body )
staticprotected

Send mail using a PEAR mailer.

Parameters
Mail_smtp$mailer
string[] | string$dest
array$headers
string$body
Returns
Status

Definition at line 57 of file UserMailer.php.

References wfDebug().


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