\Horde_Mail_Transport

Mail transport base class.

Summary

Methods
Properties
Constants
__get()
send()
prepareHeaders()
parseRecipients()
$sep
$eai
No constants found
_sanitizeHeaders()
_normalizeEOL()
_getFrom()
$_params
N/A
No private methods found
No private properties found
N/A

Properties

$sep

$sep : string

Line terminator used for separating header lines.

Type

string

$eai

$eai : boolean

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

Type

boolean

$_params

$_params : array

Configuration parameters.

Type

array

Methods

__get()

__get(  $name) 

Parameters

$name

send()

send(mixed  $recipients, array  $headers, mixed  $body) 

Send a message.

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 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.

mixed $body

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

Throws

\Horde_Mail_Exception

prepareHeaders()

prepareHeaders(array  $headers) : mixed

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

Parameters

array $headers

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.

Throws

\Horde_Mail_Exception

Returns

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.

parseRecipients()

parseRecipients(mixed  $recipients) : array

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.

Parameters

mixed $recipients

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

Throws

\Horde_Mail_Exception

Returns

array —

Forward paths (bare addresses, IDN encoded).

_sanitizeHeaders()

_sanitizeHeaders(array  $headers) : array

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.

Raw headers are sent as-is.

Parameters

array $headers

The associative array of headers to sanitize.

Returns

array —

The sanitized headers.

_normalizeEOL()

_normalizeEOL(string  $data) : string

Normalizes EOLs in string data.

Parameters

string $data

Data.

Returns

string —

Normalized data.

_getFrom()

_getFrom(string  $from, array  $headers) : string

Get the from address.

Parameters

string $from

From address.

array $headers

Headers array.

Throws

\Horde_Mail_Exception

Returns

string —

Address object.