|
| Mail_mail ($params=null) |
| Constructor. More...
|
|
| send ($recipients, $headers, $body) |
| Implements Mail_mail::send() function using php's built-in mail() command. More...
|
|
& | factory ($driver, $params=array()) |
| Provides an interface for generating Mail:: objects of various types. More...
|
|
| send ($recipients, $headers, $body) |
| Implements Mail::send() function using php's built-in mail() command. More...
|
|
| _sanitizeHeaders (&$headers) |
| Sanitize an array of mail headers by removing any additional header strings present in a legitimate header's value. More...
|
|
| prepareHeaders ($headers) |
| Take an array of mail headers and return a string containing text usable in sending a message. More...
|
|
| parseRecipients ($recipients) |
| Take a set of recipients and parse them, returning an array of bare addresses (forward paths) that can be passed to sendmail or an smtp server with the rcpt to: command. More...
|
|
Definition at line 51 of file mail.php.
◆ Mail_mail()
Mail_mail::Mail_mail |
( |
|
$params = null | ) |
|
Constructor.
Instantiates a new Mail_mail:: object based on the parameters passed in.
- Parameters
-
array | $params | Extra arguments for the mail() function. |
Definition at line 67 of file mail.php.
72 if (is_array($params)) {
73 $this->_params = join(
' ', $params);
75 $this->_params = $params;
82 if (defined(
'PHP_EOL')) {
85 $this->sep = (strpos(PHP_OS,
'WIN') ===
false) ?
"\n" :
"\r\n";
◆ send()
Mail_mail::send |
( |
|
$recipients, |
|
|
|
$headers, |
|
|
|
$body |
|
) |
| |
Implements Mail_mail::send() function using php's built-in mail() command.
- Parameters
-
mixed | $recipients | Either a comma-seperated list of recipients (RFC822 compliant), or an array of recipients, each RFC822 valid. This may contain recipients not specified in the headers, for Bcc:, resending messages, etc. |
array | $headers | The array of headers to send with the mail, in an associative array, where the array key is the header name (ie, 'Subject'), and the array value is the header value (ie, 'test'). The header produced from those values would be 'Subject: test'. |
string | $body | The full text of the message body, including any Mime parts, etc. |
- Returns
- mixed Returns true on success, or a PEAR_Error containing a descriptive error message on failure.
public
Definition at line 115 of file mail.php.
References $result, Mail\_sanitizeHeaders(), Mail\prepareHeaders(), and PEAR\raiseError().
117 if (!is_array($headers)) {
122 if (is_a(
$result,
'PEAR_Error')) {
127 if (is_array($recipients)) {
128 $recipients = implode(
', ', $recipients);
134 if (isset($headers[
'Subject'])) {
135 $subject = $headers[
'Subject'];
136 unset($headers[
'Subject']);
141 unset($headers[
'To']);
145 if (is_a($headerElements,
'PEAR_Error')) {
146 return $headerElements;
148 list(, $text_headers) = $headerElements;
152 if (empty($this->_params) || ini_get(
'safe_mode')) {
153 $result = mail($recipients, $subject, $body, $text_headers);
155 $result = mail($recipients, $subject, $body, $text_headers,
_sanitizeHeaders(&$headers)
Sanitize an array of mail headers by removing any additional header strings present in a legitimate h...
prepareHeaders($headers)
Take an array of mail headers and return a string containing text usable in sending a message...
& raiseError($message=null, $code=null, $mode=null, $options=null, $userinfo=null, $error_class=null, $skipmsg=false)
This method is a wrapper that returns an instance of the configured error class with this object's de...
◆ $_params
The documentation for this class was generated from the following file: