ILIAS  Release_4_1_x_branch Revision 61804
 All Data Structures Namespaces Files Functions Variables Groups Pages
Mail_mock Class Reference
+ Inheritance diagram for Mail_mock:
+ Collaboration diagram for Mail_mock:

Public Member Functions

 Mail_mock ($params)
 Constructor.
 send ($recipients, $headers, $body)
 Implements Mail_mock::send() function.
- Public Member Functions inherited from Mail
factory ($driver, $params=array())
 Provides an interface for generating Mail:: objects of various types.
 _sanitizeHeaders (&$headers)
 Sanitize an array of mail headers by removing any additional header strings present in a legitimate header's value.
 prepareHeaders ($headers)
 Take an array of mail headers and return a string containing text usable in sending a message.
 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.

Data Fields

 $sentMessages = array()
 $_preSendCallback
 $_postSendCallback
- Data Fields inherited from Mail
 $sep = "\r\n"

Detailed Description

Definition at line 52 of file mock.php.

Member Function Documentation

Mail_mock::Mail_mock (   $params)

Constructor.

Instantiates a new Mail_mock:: object based on the parameters passed in. It looks for the following parameters, both optional: preSendCallback Called before an email would be sent. postSendCallback Called after an email would have been sent.

Parameters
arrayHash containing any parameters. public

Definition at line 87 of file mock.php.

{
if (isset($params['preSendCallback']) &&
is_callable($params['preSendCallback'])) {
$this->_preSendCallback = $params['preSendCallback'];
}
if (isset($params['postSendCallback']) &&
is_callable($params['postSendCallback'])) {
$this->_postSendCallback = $params['postSendCallback'];
}
}
Mail_mock::send (   $recipients,
  $headers,
  $body 
)

Implements Mail_mock::send() function.

Silently discards all mail.

Parameters
mixed$recipientsEither 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$headersThe 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$bodyThe 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

Reimplemented from Mail.

Definition at line 125 of file mock.php.

{
if ($this->_preSendCallback) {
call_user_func_array($this->_preSendCallback,
array(&$this, $recipients, $headers, $body));
}
$entry = array('recipients' => $recipients, 'headers' => $headers, 'body' => $body);
$this->sentMessages[] = $entry;
if ($this->_postSendCallback) {
call_user_func_array($this->_postSendCallback,
array(&$this, $recipients, $headers, $body));
}
return true;
}

Field Documentation

Mail_mock::$_postSendCallback

Definition at line 74 of file mock.php.

Mail_mock::$_preSendCallback

Definition at line 67 of file mock.php.

Mail_mock::$sentMessages = array()

Definition at line 60 of file mock.php.


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