|
MediaWiki
REL1_24
|
Collection of static functions for sending mail. More...
Static Public Member Functions | |
| static | arrayToHeaderString ($headers, $endl="\n") |
| Creates a single string from an associative array. | |
| static | errorHandler ($code, $string) |
| Set the mail error message in self::$mErrorString. | |
| static | makeMsgId () |
| Create a value suitable for the MessageId Header. | |
| 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, $replyto=null, $contentType= 'text/plain;charset=UTF-8') |
| This function will perform a direct (authenticated) login to a SMTP Server to use for mail relaying if 'wgSMTP' specifies an array of parameters. | |
Static Protected Member Functions | |
| static | quotedPrintableCallback ($matches) |
| static | sendWithPear ($mailer, $dest, $headers, $body) |
| Send mail using a PEAR mailer. | |
Static Private Attributes | |
| static | $mErrorString |
Collection of static functions for sending mail.
Definition at line 30 of file UserMailer.php.
| static UserMailer::arrayToHeaderString | ( | $ | headers, |
| $ | endl = "\n" |
||
| ) | [static] |
Creates a single string from an associative array.
| array | $headers | Associative Array: keys are header field names, values are ... values. |
| string | $endl | The end of line character. Defaults to "\n" |
Note RFC2822 says newlines must be CRLF (
) but php mail naively "corrects" it and requires
for the "correction" to work
Definition at line 67 of file UserMailer.php.
References $name, $value, array(), as, and sanitizeHeaderValue().
Referenced by send().
| static UserMailer::errorHandler | ( | $ | code, |
| $ | string | ||
| ) | [static] |
Set the mail error message in self::$mErrorString.
| int | $code | Error number |
| string | $string | Error message |
Definition at line 363 of file UserMailer.php.
| static UserMailer::makeMsgId | ( | ) | [static] |
Create a value suitable for the MessageId Header.
Definition at line 82 of file UserMailer.php.
References global, wfParseUrl(), and wfWikiID().
Referenced by send().
| static UserMailer::quotedPrintable | ( | $ | string, |
| $ | charset = '' |
||
| ) | [static] |
Converts a string into quoted-printable format.
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
| string | $string | |
| string | $charset |
Definition at line 402 of file UserMailer.php.
References $out, array(), and empty.
Referenced by send(), UserMailerTest\testQuotedPrintable(), and MailAddress\toString().
| static UserMailer::quotedPrintableCallback | ( | $ | matches | ) | [static, protected] |
Definition at line 422 of file UserMailer.php.
References $matches.
| static UserMailer::rfc822Phrase | ( | $ | phrase | ) | [static] |
Converts a string into a valid RFC 822 "phrase", such as is used for the sender name.
| string | $phrase |
Definition at line 381 of file UserMailer.php.
References sanitizeHeaderValue().
| static UserMailer::sanitizeHeaderValue | ( | $ | val | ) | [static] |
Strips bad characters from a header value to prevent PHP mail header injection attacks.
| string | $val | String to be santizied |
Definition at line 372 of file UserMailer.php.
References array().
Referenced by arrayToHeaderString(), and rfc822Phrase().
| static UserMailer::send | ( | $ | to, |
| $ | from, | ||
| $ | subject, | ||
| $ | body, | ||
| $ | replyto = null, |
||
| $ | contentType = 'text/plain; charset=UTF-8' |
||
| ) | [static] |
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.
| MailAddress|MailAddress[] | $to Recipient's email (or an array of them) | |
| MailAddress | $from | Sender's email |
| string | $subject | Email's subject. |
| string | $body | Email's text or Array of two strings to be the text and html bodies |
| MailAddress | $replyto | Optional reply-to email (default: null). |
| string | $contentType | Optional custom Content-Type (default: text/plain; charset=UTF-8) |
| MWException | |
| Exception |
Definition at line 111 of file UserMailer.php.
References $e, $from, $mime, $ret, array(), arrayToHeaderString(), as, MWTimestamp\getLocalInstance(), global, mail, makeMsgId(), Status\newFatal(), Status\newGood(), quotedPrintable(), sendWithPear(), wfDebug(), wfIniGetBool(), wfIsWindows(), wfRestoreWarnings(), wfRunHooks(), and wfSuppressWarnings().
Referenced by EmaillingJob\run().
| static UserMailer::sendWithPear | ( | $ | mailer, |
| $ | dest, | ||
| $ | headers, | ||
| $ | body | ||
| ) | [static, protected] |
Send mail using a PEAR mailer.
| UserMailer | $mailer | |
| string | $dest | |
| string | $headers | |
| string | $body |
Definition at line 43 of file UserMailer.php.
References Status\newFatal(), Status\newGood(), and wfDebug().
Referenced by send().
UserMailer::$mErrorString [static, private] |
Definition at line 31 of file UserMailer.php.