Swift_Transport_EsmtpTransport
extends Swift_Transport_AbstractSmtpTransport
in package
implements
Swift_Transport_SmtpAgent
Sends Messages over SMTP with ESMTP support.
Tags
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
$addressEncoder
protected
mixed
$addressEncoder
$buffer
Input-Output buffer for sending/receiving SMTP commands and responses
protected
mixed
$buffer
$domain
The domain name to use in HELO command
protected
mixed
$domain
= '[127.0.0.1]'
$eventDispatcher
The event dispatching layer
protected
mixed
$eventDispatcher
$pipeline
The pipelined commands waiting for response
protected
mixed
$pipeline
= []
$pipelining
Whether the PIPELINING SMTP extension is enabled (RFC 2920)
protected
mixed
$pipelining
=
ull
$sourceIp
Source Ip
protected
mixed
$sourceIp
$started
Connection status
protected
mixed
$started
= alse
$capabilities
ESMTP capabilities.
private
array<string|int, string>
$capabilities
= []
$handlers
ESMTP extension handlers.
private
array<string|int, Swift_Transport_EsmtpHandler>
$handlers
= []
$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 —__destruct()
Destructor.
public
__destruct() : mixed
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
getAddressEncoder()
public
getAddressEncoder() : mixed
Return values
mixed —getBuffer()
Get the IoBuffer where read/writes are occurring.
public
getBuffer() : Swift_Transport_IoBuffer
Return values
Swift_Transport_IoBuffer —getEncryption()
Get the encryption type.
public
getEncryption() : string
Return values
string —getExtensionHandlers()
Get ESMTP extension handlers.
public
getExtensionHandlers() : array<string|int, Swift_Transport_EsmtpHandler>
Return values
array<string|int, Swift_Transport_EsmtpHandler> —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
registerPlugin()
Register a plugin.
public
registerPlugin(Swift_Events_EventListener $plugin) : mixed
Parameters
- $plugin : Swift_Events_EventListener
Return values
mixed —reset()
Reset the current mail transaction.
public
reset() : mixed
Return values
mixed —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 —setAddressEncoder()
public
setAddressEncoder(Swift_AddressEncoder $addressEncoder) : mixed
Parameters
- $addressEncoder : Swift_AddressEncoder
Return values
mixed —setEncryption()
Set the encryption type (tls or ssl).
public
setEncryption(string $encryption) : $this
Parameters
- $encryption : string
Return values
$this —setExtensionHandlers()
Set ESMTP extension handlers.
public
setExtensionHandlers(array<string|int, Swift_Transport_EsmtpHandler> $handlers) : $this
Parameters
- $handlers : array<string|int, Swift_Transport_EsmtpHandler>
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 —start()
Start the SMTP connection.
public
start() : mixed
Return values
mixed —stop()
Stop the SMTP connection.
public
stop() : mixed
Return values
mixed —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 —getReversePath()
Determine the best-use reverse path for this message
protected
getReversePath(Swift_Mime_SimpleMessage $message) : mixed
Parameters
- $message : Swift_Mime_SimpleMessage
Return values
mixed —readGreeting()
Read the opening SMTP greeting
protected
readGreeting() : mixed
Return values
mixed —streamMessage()
Stream the contents of the message over the buffer
protected
streamMessage(Swift_Mime_SimpleMessage $message) : mixed
Parameters
- $message : Swift_Mime_SimpleMessage
Return values
mixed —throwException()
Throw a TransportException, first sending it to any listeners
protected
throwException(Swift_TransportException $e) : mixed
Parameters
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