\rcube_smtp

Class to provide SMTP functionality using PEAR Net_SMTP

Summary

Methods
Properties
Constants
connect()
send_mail()
reset()
disconnect()
debug_handler()
get_error()
get_response()
No public properties found
SMTP_MIME_CRLF
DEBUG_LINE_LENGTH
No protected methods found
No protected properties found
N/A
_prepare_headers()
_parse_rfc822()
_process_xclient()
_conn_error()
$conn
$response
$error
$anonymize_log
N/A

Constants

SMTP_MIME_CRLF

SMTP_MIME_CRLF = "\r\n"

DEBUG_LINE_LENGTH

DEBUG_LINE_LENGTH = 4098

Properties

$conn

$conn

$response

$response

$error

$error

$anonymize_log

$anonymize_log

Methods

connect()

connect(string  $host = null, string  $port = null, string  $user = null, string  $pass = null) : bool

SMTP Connection and authentication

Parameters

string $host

Server host

string $port

Server port

string $user

User name

string $pass

Password

Returns

bool —

True on success, or False on error

send_mail()

send_mail(string  $from, mixed  $recipients, mixed  $headers, mixed  $body, array  $opts = []) : bool

Function for sending mail

Parameters

string $from

Sender e-Mail address

mixed $recipients

Either a comma-separated 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.

mixed $headers

The message headers to send with the mail Either as an associative array or a finally formatted string

mixed $body

The full text of the message body, including any Mime parts or file handle

array $opts

Delivery options (e.g. DSN request)

Returns

bool —

True on success, or False on error

reset()

reset() : mixed

Reset the global SMTP connection

Returns

mixed —

disconnect()

disconnect() : mixed

Disconnect the global SMTP connection

Returns

mixed —

debug_handler()

debug_handler(mixed  $smtp, mixed  $message) : mixed

This is our own debug handler for the SMTP connection

Parameters

mixed $smtp
mixed $message

Returns

mixed —

get_error()

get_error() : mixed

Get error message

Returns

mixed —

get_response()

get_response() : mixed

Get server response messages array

Returns

mixed —

_prepare_headers()

_prepare_headers(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'.

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.

_parse_rfc822()

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

Returns

array —

An array of forward paths (bare addresses).

_process_xclient()

_process_xclient(mixed  $use_tls, mixed  $helo_host) : mixed

Send XCLIENT command if configured and supported

Parameters

mixed $use_tls
mixed $helo_host

Returns

mixed —

_conn_error()

_conn_error(mixed  $label, mixed  $message, mixed  $vars = [], mixed  $result = null) : mixed

Handle connection error

Parameters

mixed $label
mixed $message
mixed $vars
mixed $result

Returns

mixed —