Documentation

Horde_Mail_Transport_Smtphorde extends Horde_Mail_Transport
in package

SMTP implementation using Horde_Smtp.

Tags
author

Michael Slusarz slusarz@horde.org

category

Horde

copyright

2013-2017 Horde LLC

license

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

Table of Contents

$eai  : bool
$send8bit  : mixed
$sep  : string
Line terminator used for separating header lines.
$_params  : array<string|int, mixed>
Configuration parameters.
$_smtp  : Horde_Smtp
SMTP object.
__construct()  : mixed
Constructor.
__get()  : mixed
getSMTPObject()  : Horde_Smtp
Connect to the SMTP server by instantiating a Horde_Smtp object.
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)

$send8bit

public mixed $send8bit = \false
Tags
deprecated

$sep

Line terminator used for separating header lines.

public string $sep = \PHP_EOL

$_params

Configuration parameters.

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

$_smtp

SMTP object.

protected Horde_Smtp $_smtp = \null

Methods

__construct()

Constructor.

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

Additional parameters:

  • chunk_size: (integer) If CHUNKING is supported on the server, the chunk size (in octets) to send. 0 will disable chunking. @since Horde_Smtp 1.7.0
  • context: (array) Any context parameters passed to stream_create_context(). @since Horde_Smtp 1.9.0
  • debug: (string) If set, will output debug information to the stream provided. The value can be any PHP supported wrapper that can be opened via fopen(). DEFAULT: No debug output
  • host: (string) The SMTP server. DEFAULT: localhost
  • localhost: (string) The hostname of the localhost. (since Horde_Smtp 1.9.0) DEFAULT: Auto-determined.
  • password: (string) The SMTP password. DEFAULT: NONE
  • port: (string) The SMTP port. DEFAULT: 587
  • secure: (string) Use SSL or TLS to connect. DEFAULT: true (use 'tls' option, if available)
    • false (No encryption)
    • 'ssl' (Auto-detect SSL version)
    • 'sslv2' (Force SSL version 2)
    • 'sslv3' (Force SSL version 3)
    • 'tls' (TLS; started via protocol-level negotation over unencrypted channel; RECOMMENDED way of initiating secure connection)
    • 'tlsv1' (TLS direct version 1.x connection to server) [@since Horde_Smtp .3.0]
    • true (Use TLS, if available) [@since Horde_Smtp 1.2.0] DEFAULT: No encryption
  • timeout: (integer) Connection timeout, in seconds. DEFAULT: 30 seconds
  • username: (string) The SMTP username. DEFAULT: NONE
  • xoauth2_token: (string) If set, will authenticate via the XOAUTH2 mechanism (if available) with this token. Either a string or a Horde_Smtp_Password object (since Horde_Smtp 1.1.0).
Return values
mixed

__get()

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

getSMTPObject()

Connect to the SMTP server by instantiating a Horde_Smtp object.

public getSMTPObject() : Horde_Smtp
Tags
throws
Horde_Mail_Exception
Return values
Horde_Smtp

The SMTP object.

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