Documentation

Swift_Transport_EsmtpTransport extends Swift_Transport_AbstractSmtpTransport
in package
implements Swift_Transport_SmtpAgent

Sends Messages over SMTP with ESMTP support.

Tags
author

Chris Corbyn

Interfaces, Classes and Traits

Swift_Transport_SmtpAgent
Wraps an IoBuffer to send/receive SMTP commands/responses.

Table of Contents

$addressEncoder  : mixed
$buffer  : mixed
Input-Output buffer for sending/receiving SMTP commands and responses
$domain  : mixed
The domain name to use in HELO command
$eventDispatcher  : mixed
The event dispatching layer
$pipeline  : mixed
The pipelined commands waiting for response
$pipelining  : mixed
Whether the PIPELINING SMTP extension is enabled (RFC 2920)
$sourceIp  : mixed
Source Ip
$started  : mixed
Connection status
$capabilities  : array<string|int, string>
ESMTP capabilities.
$handlers  : array<string|int, Swift_Transport_EsmtpHandler>
ESMTP extension handlers.
$params  : array<string|int, mixed>
Connection buffer parameters.
__call()  : mixed
Mixin handling method for ESMTP handlers
__construct()  : mixed
Creates a new EsmtpTransport using the given I/O buffer.
__destruct()  : mixed
Destructor.
executeCommand()  : string|null
Run a command against the buffer, expecting the given response codes.
getAddressEncoder()  : mixed
getBuffer()  : Swift_Transport_IoBuffer
Get the IoBuffer where read/writes are occurring.
getEncryption()  : string
Get the encryption type.
getExtensionHandlers()  : array<string|int, Swift_Transport_EsmtpHandler>
Get ESMTP extension handlers.
getHost()  : string
Get the host to connect to.
getLocalDomain()  : string
Get the name of the domain Swift will identify as.
getPipelining()  : bool|null
Returns whether SMTP pipelining is enabled.
getPort()  : int
Get the port to connect to.
getSourceIp()  : string
Returns the IP used to connect to the destination.
getStreamOptions()  : array<string|int, mixed>
Returns the stream context options.
getTimeout()  : int
Get the connection timeout.
isStarted()  : bool
Test if an SMTP connection has been established.
ping()  : bool
Check if this Transport mechanism is alive.
registerPlugin()  : mixed
Register a plugin.
reset()  : mixed
Reset the current mail transaction.
send()  : int
Send the given Message.
setAddressEncoder()  : mixed
setEncryption()  : $this
Set the encryption type (tls or ssl).
setExtensionHandlers()  : $this
Set ESMTP extension handlers.
setHost()  : $this
Set the host to connect to.
setLocalDomain()  : $this
Set the name of the local domain which Swift will identify itself as.
setPipelining()  : $this
Sets whether SMTP pipelining is enabled.
setPort()  : $this
Set the port to connect to.
setSourceIp()  : $this
Sets the source IP.
setStreamOptions()  : $this
Sets the stream context options.
setTimeout()  : $this
Set the connection timeout.
start()  : mixed
Start the SMTP connection.
stop()  : mixed
Stop the SMTP connection.
assertResponseCode()  : mixed
Throws an Exception if a response code is incorrect
doDataCommand()  : mixed
Send the DATA command
doHeloCommand()  : mixed
Overridden to perform EHLO instead
doMailFromCommand()  : mixed
Overridden to add Extension support
doRcptToCommand()  : mixed
Overridden to add Extension support
getBufferParams()  : mixed
Get the params to initialize the buffer
getFullResponse()  : mixed
Get an entire multi-line response using its sequence number
getReversePath()  : mixed
Determine the best-use reverse path for this message
readGreeting()  : mixed
Read the opening SMTP greeting
streamMessage()  : mixed
Stream the contents of the message over the buffer
throwException()  : mixed
Throw a TransportException, first sending it to any listeners
doMailTransaction()  : mixed
Send an email to the given recipients from the given reverse path
getActiveHandlers()  : mixed
Get ESMTP handlers which are currently ok to use
getCapabilities()  : mixed
Determine ESMTP capabilities by function group
sendBcc()  : mixed
Send a message to all Bcc: recipients
sendTo()  : mixed
Send a message to the given To: recipients
setHandlerParams()  : mixed
Set parameters which are used by each extension handler

Properties

$buffer

Input-Output buffer for sending/receiving SMTP commands and responses

protected mixed $buffer

$pipelining

Whether the PIPELINING SMTP extension is enabled (RFC 2920)

protected mixed $pipelining = ull

$capabilities

ESMTP capabilities.

private array<string|int, string> $capabilities = []

$params

Connection buffer parameters.

private array<string|int, mixed> $params = ['protocol' => 'tcp', 'host' => 'localhost', 'port' => 25, 'timeout' => 30, 'blocking' => 1, 'tls' => alse, 'type' => Swift_Transport_IoBuffer::TYPE_SOCKET, 'stream_context_options' => []]

Methods

__call()

Mixin handling method for ESMTP handlers

public __call(mixed $method, mixed $args) : mixed
Parameters
$method : mixed
$args : mixed
Return values
mixed —

__construct()

Creates a new EsmtpTransport using the given I/O buffer.

public __construct(Swift_Transport_IoBuffer $buf, array<string|int, Swift_Transport_EsmtpHandler> $extensionHandlers, Swift_Events_EventDispatcher $dispatcher[, string $localDomain = '127.0.0.1' ][, Swift_AddressEncoder $addressEncoder = null ]) : mixed
Parameters
$buf : Swift_Transport_IoBuffer
$extensionHandlers : array<string|int, Swift_Transport_EsmtpHandler>
$dispatcher : Swift_Events_EventDispatcher
$localDomain : string = '127.0.0.1'
$addressEncoder : Swift_AddressEncoder = null
Return values
mixed —

executeCommand()

Run a command against the buffer, expecting the given response codes.

public executeCommand(string $command[, array<string|int, int> $codes = [] ][, array<string|int, string> &$failures = null ][, bool $pipeline = false ][, string $address = null ]) : string|null

If no response codes are given, the response will not be validated. If codes are given, an exception will be thrown on an invalid response.

Parameters
$command : string
$codes : array<string|int, int> = []
$failures : array<string|int, string> = null

An array of failures by-reference

$pipeline : bool = false

Do not wait for response

$address : string = null

The address, if command is RCPT TO.

Return values
string|null —

The server response, or null if pipelining is enabled

getEncryption()

Get the encryption type.

public getEncryption() : string
Return values
string —

getHost()

Get the host to connect to.

public getHost() : string
Return values
string —

getLocalDomain()

Get the name of the domain Swift will identify as.

public getLocalDomain() : string

If an IP address was specified, this will be returned wrapped in square brackets as described in RFC 5321, section 4.1.3.

Return values
string —

getPipelining()

Returns whether SMTP pipelining is enabled.

public getPipelining() : bool|null
Return values
bool|null —

a boolean if pipelining is explicitly enabled or disabled, or null if support is auto-detected.

getPort()

Get the port to connect to.

public getPort() : int
Return values
int —

getSourceIp()

Returns the IP used to connect to the destination.

public getSourceIp() : string
Return values
string —

getStreamOptions()

Returns the stream context options.

public getStreamOptions() : array<string|int, mixed>
Return values
array<string|int, mixed> —

getTimeout()

Get the connection timeout.

public getTimeout() : int
Return values
int —

isStarted()

Test if an SMTP connection has been established.

public isStarted() : bool
Return values
bool —

ping()

Check if this Transport mechanism is alive.

public ping() : bool
Return values
bool —

TRUE if the transport is alive

send()

Send the given Message.

public send(Swift_Mime_SimpleMessage $message[, array<string|int, string> &$failedRecipients = null ]) : int

Recipient/sender data will be retrieved from the Message API. The return value is the number of recipients who were accepted for delivery.

Parameters
$message : Swift_Mime_SimpleMessage
$failedRecipients : array<string|int, string> = null

An array of failures by-reference

Return values
int —

setEncryption()

Set the encryption type (tls or ssl).

public setEncryption(string $encryption) : $this
Parameters
$encryption : string
Return values
$this —

setHost()

Set the host to connect to.

public setHost(string $host) : $this

Literal IPv6 addresses should be wrapped in square brackets.

Parameters
$host : string
Return values
$this —

setLocalDomain()

Set the name of the local domain which Swift will identify itself as.

public setLocalDomain(string $domain) : $this

This should be a fully-qualified domain name and should be truly the domain you're using.

If your server does not have a domain name, use the IP address. This will automatically be wrapped in square brackets as described in RFC 5321, section 4.1.3.

Parameters
$domain : string
Return values
$this —

setPipelining()

Sets whether SMTP pipelining is enabled.

public setPipelining(bool $enabled) : $this

By default, support is auto-detected using the PIPELINING SMTP extension. Use this function to override that in the unlikely event of compatibility issues.

Parameters
$enabled : bool
Return values
$this —

setPort()

Set the port to connect to.

public setPort(int $port) : $this
Parameters
$port : int
Return values
$this —

setSourceIp()

Sets the source IP.

public setSourceIp(string $source) : $this

IPv6 addresses should be wrapped in square brackets.

Parameters
$source : string
Return values
$this —

setStreamOptions()

Sets the stream context options.

public setStreamOptions(array<string|int, mixed> $options) : $this
Parameters
$options : array<string|int, mixed>
Return values
$this —

setTimeout()

Set the connection timeout.

public setTimeout(int $timeout) : $this
Parameters
$timeout : int

seconds

Return values
$this —

assertResponseCode()

Throws an Exception if a response code is incorrect

protected assertResponseCode(mixed $response, mixed $wanted) : mixed
Parameters
$response : mixed
$wanted : mixed
Return values
mixed —

doDataCommand()

Send the DATA command

protected doDataCommand(mixed &$failedRecipients) : mixed
Parameters
$failedRecipients : mixed
Return values
mixed —

doHeloCommand()

Overridden to perform EHLO instead

protected doHeloCommand() : mixed
Return values
mixed —

doMailFromCommand()

Overridden to add Extension support

protected doMailFromCommand(mixed $address) : mixed
Parameters
$address : mixed
Return values
mixed —

doRcptToCommand()

Overridden to add Extension support

protected doRcptToCommand(mixed $address) : mixed
Parameters
$address : mixed
Return values
mixed —

getBufferParams()

Get the params to initialize the buffer

protected getBufferParams() : mixed
Return values
mixed —

getFullResponse()

Get an entire multi-line response using its sequence number

protected getFullResponse(mixed $seq) : mixed
Parameters
$seq : mixed
Return values
mixed —

readGreeting()

Read the opening SMTP greeting

protected readGreeting() : mixed
Return values
mixed —

doMailTransaction()

Send an email to the given recipients from the given reverse path

private doMailTransaction(mixed $message, mixed $reversePath, array<string|int, mixed> $recipients, array<string|int, mixed> &$failedRecipients) : mixed
Parameters
$message : mixed
$reversePath : mixed
$recipients : array<string|int, mixed>
$failedRecipients : array<string|int, mixed>
Return values
mixed —

getActiveHandlers()

Get ESMTP handlers which are currently ok to use

private getActiveHandlers() : mixed
Return values
mixed —

getCapabilities()

Determine ESMTP capabilities by function group

private getCapabilities(mixed $ehloResponse) : mixed
Parameters
$ehloResponse : mixed
Return values
mixed —

sendBcc()

Send a message to all Bcc: recipients

private sendBcc(Swift_Mime_SimpleMessage $message, mixed $reversePath, array<string|int, mixed> $bcc, array<string|int, mixed> &$failedRecipients) : mixed
Parameters
$message : Swift_Mime_SimpleMessage
$reversePath : mixed
$bcc : array<string|int, mixed>
$failedRecipients : array<string|int, mixed>
Return values
mixed —

sendTo()

Send a message to the given To: recipients

private sendTo(Swift_Mime_SimpleMessage $message, mixed $reversePath, array<string|int, mixed> $to, array<string|int, mixed> &$failedRecipients) : mixed
Parameters
$message : Swift_Mime_SimpleMessage
$reversePath : mixed
$to : array<string|int, mixed>
$failedRecipients : array<string|int, mixed>
Return values
mixed —

setHandlerParams()

Set parameters which are used by each extension handler

private setHandlerParams() : mixed
Return values
mixed —

Search results