Documentation

Horde_Mail_Transport_Mock extends Horde_Mail_Transport
in package

Mock implementation, for testing.

Tags
author

Chuck Hagenbuch chuck@horde.org

author

Michael Slusarz slusarz@horde.org

category

Horde

copyright

2010-2017 Horde LLC

license

http://www.horde.org/licenses/bsd New BSD License

Table of Contents

$eai  : bool
$sentMessages  : array<string|int, mixed>
Array of messages that have been sent with the mock.
$sep  : string
Line terminator used for separating header lines.
$_params  : array<string|int, mixed>
Configuration parameters.
$_postSendCallback  : callable
Callback after sending mai.
$_preSendCallback  : callable
Callback before sending mail.
__construct()  : mixed
__get()  : mixed
parseRecipients()  : array<string|int, mixed>
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.
prepareHeaders()  : mixed
Take an array of mail headers and return a string containing text usable in sending a message.
send()  : mixed
Send a message.
_getFrom()  : string
Get the from address.
_normalizeEOL()  : string
Normalizes EOLs in string data.
_sanitizeHeaders()  : array<string|int, mixed>
Sanitize an array of mail headers by removing any additional header strings present in a legitimate header's value. The goal of this filter is to prevent mail injection attacks.

Properties

$eai read-only

public bool $eai

Does the transport driver support EAI (RFC 6532) headers? (@since 2.5.0)

$sentMessages

Array of messages that have been sent with the mock.

public array<string|int, mixed> $sentMessages = array()

$sep

Line terminator used for separating header lines.

public string $sep = \PHP_EOL

$_params

Configuration parameters.

protected array<string|int, mixed> $_params = array()

$_postSendCallback

Callback after sending mai.

protected callable $_postSendCallback

$_preSendCallback

Callback before sending mail.

protected callable $_preSendCallback

Methods

__construct()

public __construct([array<string|int, mixed> $params = array() ]) : mixed
Parameters
$params : array<string|int, mixed> = array()
Return values
mixed

__get()

public __get(mixed $name) : mixed
Parameters
$name : mixed
Return values
mixed

parseRecipients()

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.

public parseRecipients(mixed $recipients) : array<string|int, mixed>
Parameters
$recipients : mixed

Either a comma-separated list of recipients (RFC822 compliant), or an array of recipients, each RFC822 valid.

Tags
throws
Horde_Mail_Exception
Return values
array<string|int, mixed>

Forward paths (bare addresses, IDN encoded).

prepareHeaders()

Take an array of mail headers and return a string containing text usable in sending a message.

public prepareHeaders(array<string|int, mixed> $headers) : mixed
Parameters
$headers : array<string|int, mixed>

The array of headers to prepare, 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'. If the '_raw' key exists, the value of this key will be used as the exact text for sending the message.

Tags
throws
Horde_Mail_Exception
Return values
mixed

Returns false if it encounters a bad address; otherwise returns an array containing two elements: Any From: address found in the headers, and the plain text version of the headers.

send()

Send a message.

public send(mixed $recipients, array<string|int, mixed> $headers, mixed $body) : mixed
Parameters
$recipients : mixed

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.

$headers : array<string|int, mixed>

The 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'. If the '_raw' key exists, the value of this key will be used as the exact text for sending the message.

$body : mixed

The full text of the message body, including any Mime parts, etc. Either a string or a stream resource.

Return values
mixed

_getFrom()

Get the from address.

protected _getFrom(string $from, array<string|int, mixed> $headers) : string
Parameters
$from : string

From address.

$headers : array<string|int, mixed>

Headers array.

Tags
throws
Horde_Mail_Exception
Return values
string

Address object.

_normalizeEOL()

Normalizes EOLs in string data.

protected _normalizeEOL(string $data) : string
Parameters
$data : string

Data.

Return values
string

Normalized data.

_sanitizeHeaders()

Sanitize an array of mail headers by removing any additional header strings present in a legitimate header's value. The goal of this filter is to prevent mail injection attacks.

protected _sanitizeHeaders(array<string|int, mixed> $headers) : array<string|int, mixed>

Raw headers are sent as-is.

Parameters
$headers : array<string|int, mixed>

The associative array of headers to sanitize.

Return values
array<string|int, mixed>

The sanitized headers.

Search results