Horde_Mail_Transport_Smtpmx
extends Horde_Mail_Transport
in package
SMTP MX implementation.
Tags
Table of Contents
- $eai : bool
- $sep : string
- Line terminator used for separating header lines.
- $_errorCode : array<string|int, mixed>
- Internal error codes.
- $_params : array<string|int, mixed>
- Configuration parameters.
- $_resolver : Net_DNS2_Resolver
- Net_DNS2_Resolver object.
- $_smtp : Net_SMTP
- SMTP connection object.
- __construct() : mixed
- __destruct() : mixed
- Destructor implementation to ensure that we disconnect from any potentially-alive persistent SMTP connections.
- __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.
- _error() : mixed
- Format error message.
- _getFrom() : string
- Get the from address.
- _getMx() : mixed
- Recieve MX records for a host.
- _loadNetDns() : mixed
- Initialize Net_DNS2_Resolver.
- _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)
$sep
Line terminator used for separating header lines.
public
string
$sep
= \PHP_EOL
$_errorCode
Internal error codes.
protected
array<string|int, mixed>
$_errorCode
= array('not_connected' => array('code' => 1, 'msg' => 'Could not connect to any mail server ({HOST}) at port {PORT} to send mail to {RCPT}.'), 'failed_vrfy_rcpt' => array('code' => 2, 'msg' => 'Recipient "{RCPT}" could not be veryfied.'), 'failed_set_from' => array('code' => 3, 'msg' => 'Failed to set sender: {FROM}.'), 'failed_set_rcpt' => array('code' => 4, 'msg' => 'Failed to set recipient: {RCPT}.'), 'failed_send_data' => array('code' => 5, 'msg' => 'Failed to send mail to: {RCPT}.'), 'no_from' => array('code' => 5, 'msg' => 'No from address has be provided.'), 'send_data' => array('code' => 7, 'msg' => 'Failed to create Net_SMTP object.'), 'no_mx' => array('code' => 8, 'msg' => 'No MX-record for {RCPT} found.'), 'no_resolver' => array('code' => 9, 'msg' => 'Could not start resolver! Install PEAR:Net_DNS2 or switch off "netdns"'), 'failed_rset' => array('code' => 10, 'msg' => 'RSET command failed, SMTP-connection corrupt.'))
Translate internal error identifier to human readable messages.
$_params
Configuration parameters.
protected
array<string|int, mixed>
$_params
= array()
$_resolver
Net_DNS2_Resolver object.
protected
Net_DNS2_Resolver
$_resolver
$_smtp
SMTP connection object.
protected
Net_SMTP
$_smtp
= \null
Methods
__construct()
public
__construct([array<string|int, mixed> $params = array() ]) : mixed
Parameters
- $params : array<string|int, mixed> = array()
-
Additional options:
- debug: (boolean) Activate SMTP debug mode? DEFAULT: false
- mailname: (string) The name of the local mail system (a valid hostname which matches the reverse lookup) DEFAULT: Auto-determined
- netdns: (boolean) Use PEAR:Net_DNS2 (true) or the PHP builtin getmxrr(). DEFAULT: true
- port: (integer) Port. DEFAULT: Auto-determined
- test: (boolean) Activate test mode? DEFAULT: false
- timeout: (integer) The SMTP connection timeout (in seconds). DEFAULT: 10
- verp: (boolean) Whether to use VERP. If not a boolean, the string value will be used as the VERP separators. DEFAULT: false
- vrfy: (boolean) Whether to use VRFY. DEFAULT: false
Return values
mixed —__destruct()
Destructor implementation to ensure that we disconnect from any potentially-alive persistent SMTP connections.
public
__destruct() : mixed
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
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
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 —_error()
Format error message.
protected
_error(string $id[, array<string|int, mixed> $info = array() ]) : mixed
Parameters
- $id : string
-
Maps error ids to codes and message.
- $info : array<string|int, mixed> = array()
-
Optional information in associative array.
Tags
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
Return values
string —Address object.
_getMx()
Recieve MX records for a host.
protected
_getMx(string $host) : mixed
Parameters
- $host : string
-
Mail host.
Return values
mixed —Sorted MX list or false on error.
_loadNetDns()
Initialize Net_DNS2_Resolver.
protected
_loadNetDns() : mixed
Return values
mixed —_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.