EsmtpTransport
extends AbstractSmtp
in package
implements
AgentInterface
ESMTP transport class
Tags
Interfaces, Classes, Traits and Enums
- AgentInterface
- SMTP agent interface
Table of Contents
- $buffer : BufferInterface
- Input-Output buffer for sending/receiving SMTP commands and responses
- $domain : string
- The domain name to use in HELO command
- $sourceIp : string
- Source IP
- $started : bool
- Connection status
- $capabilities : array<string|int, mixed>
- ESMTP capabilities
- $handlers : array<string|int, mixed>
- 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
- Run a command against the buffer, expecting the given response codes.
- getBuffer() : BufferInterface
- Get the IoBuffer where read/writes are occurring.
- getEncryption() : string
- Get the encryption type
- getExtensionHandlers() : array<string|int, mixed>
- Get ESMTP extension handlers
- getHost() : string
- Get the host to connect to
- getLocalDomain() : string
- Get the name of the domain Swift will identify as
- 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
- reset() : mixed
- Reset the current mail transaction.
- send() : int
- Send the given Message.
- setEncryption() : EsmtpTransport
- Set the encryption type (tls or ssl)
- setExtensionHandlers() : EsmtpTransport
- Set ESMTP extension handlers
- setHost() : EsmtpTransport
- Set the host to connect to
- setLocalDomain() : AbstractSmtp
- Set the name of the local domain which Swift will identify itself as.
- setPort() : EsmtpTransport
- Set the port to connect to
- setSourceIp() : EsmtpTransport
- Sets the source IP
- setStreamOptions() : EsmtpTransport
- Sets the stream context options
- setTimeout() : EsmtpTransport
- 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() : array<string|int, mixed>
- Get the params to initialize the buffer
- getFullResponse() : string
- Get an entire multi-line response using its sequence number
- getReversePath() : null|string
- 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() : int
- Send an email to the given recipients from the given reverse path
- getActiveHandlers() : mixed
- Get ESMTP handlers which are currently ok to use
- getCapabilities() : array<string|int, mixed>
- Determine ESMTP capabilities by function group
- isFqdn() : bool
- Determine is the $hostname is a fully-qualified name
- lookupHostname() : mixed
- Try to determine the hostname of the server this is run on
- sendBcc() : int
- Send a message to all Bcc: recipients
- sendTo() : int
- Send a message to the given To: recipients
- setHandlerParams() : mixed
- Set parameters which are used by each extension handler
- sortHandlers() : int
- Custom sort for extension handler ordering
Properties
$buffer
Input-Output buffer for sending/receiving SMTP commands and responses
protected
BufferInterface
$buffer
$domain
The domain name to use in HELO command
protected
string
$domain
= '[127.0.0.1]'
$sourceIp
Source IP
protected
string
$sourceIp
= null
$started
Connection status
protected
bool
$started
= false
$capabilities
ESMTP capabilities
private
array<string|int, mixed>
$capabilities
= []
$handlers
ESMTP extension handlers
private
array<string|int, mixed>
$handlers
= []
$params
Connection buffer parameters
private
array<string|int, mixed>
$params
= ['protocol' => 'tcp', 'host' => 'localhost', 'port' => 25, 'timeout' => 30, 'blocking' => 1, 'tls' => false, 'type' => \Pop\Mail\Transport\Smtp\Stream\BufferInterface::TYPE_SOCKET, 'stream_context_options' => []]
Methods
__call()
Mixin handling method for ESMTP handlers
public
__call( $method, $args) : mixed
Parameters
Tags
Return values
mixed —__construct()
Creates a new EsmtpTransport using the given I/O buffer
public
__construct([BufferInterface $buffer = null ][, array<string|int, mixed> $handlers = null ]) : mixed
Parameters
- $buffer : BufferInterface = null
- $handlers : array<string|int, mixed> = 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 = [] ]) : string
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> = []
Return values
string —getBuffer()
Get the IoBuffer where read/writes are occurring.
public
getBuffer() : BufferInterface
Return values
BufferInterface —getEncryption()
Get the encryption type
public
getEncryption() : string
Return values
string —getExtensionHandlers()
Get ESMTP extension handlers
public
getExtensionHandlers() : array<string|int, mixed>
Return values
array<string|int, mixed> —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
Return values
string —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 —reset()
Reset the current mail transaction.
public
reset() : mixed
Return values
mixed —send()
Send the given Message.
public
send(Message $message) : 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 : Message
Tags
Return values
int —setEncryption()
Set the encryption type (tls or ssl)
public
setEncryption(string $encryption) : EsmtpTransport
Parameters
- $encryption : string
Return values
EsmtpTransport —setExtensionHandlers()
Set ESMTP extension handlers
public
setExtensionHandlers(array<string|int, mixed> $handlers) : EsmtpTransport
Parameters
- $handlers : array<string|int, mixed>
Return values
EsmtpTransport —setHost()
Set the host to connect to
public
setHost(string $host) : EsmtpTransport
Parameters
- $host : string
Return values
EsmtpTransport —setLocalDomain()
Set the name of the local domain which Swift will identify itself as.
public
setLocalDomain(string $domain) : AbstractSmtp
This should be a fully-qualified domain name and should be truly the domain you're using.
If your server doesn't have a domain name, use the IP in square brackets (i.e. [127.0.0.1]).
Parameters
- $domain : string
Return values
AbstractSmtp —setPort()
Set the port to connect to
public
setPort(int $port) : EsmtpTransport
Parameters
- $port : int
Return values
EsmtpTransport —setSourceIp()
Sets the source IP
public
setSourceIp(string $source) : EsmtpTransport
Parameters
- $source : string
Return values
EsmtpTransport —setStreamOptions()
Sets the stream context options
public
setStreamOptions(array<string|int, mixed> $options) : EsmtpTransport
Parameters
- $options : array<string|int, mixed>
Return values
EsmtpTransport —setTimeout()
Set the connection timeout
public
setTimeout(int $timeout) : EsmtpTransport
Parameters
- $timeout : int
-
seconds
Return values
EsmtpTransport —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(string $response, string $wanted) : mixed
Parameters
- $response : string
- $wanted : string
Return values
mixed —doDataCommand()
Send the DATA command
protected
doDataCommand() : mixed
Return values
mixed —doHeloCommand()
Overridden to perform EHLO instead
protected
doHeloCommand() : mixed
Return values
mixed —doMailFromCommand()
Overridden to add Extension support
protected
doMailFromCommand(string $address) : mixed
Parameters
- $address : string
Return values
mixed —doRcptToCommand()
Overridden to add Extension support
protected
doRcptToCommand(string $address) : mixed
Parameters
- $address : string
Return values
mixed —getBufferParams()
Get the params to initialize the buffer
protected
getBufferParams() : array<string|int, mixed>
Return values
array<string|int, mixed> —getFullResponse()
Get an entire multi-line response using its sequence number
protected
getFullResponse(string $seq) : string
Parameters
- $seq : string
Return values
string —getReversePath()
Determine the best-use reverse path for this message
protected
getReversePath(Message $message) : null|string
Parameters
- $message : Message
Return values
null|string —readGreeting()
Read the opening SMTP greeting
protected
readGreeting() : mixed
Return values
mixed —streamMessage()
Stream the contents of the message over the buffer
protected
streamMessage(Message $message) : mixed
Parameters
- $message : Message
Return values
mixed —throwException()
Throw a TransportException, first sending it to any listeners
protected
throwException(Exception $e) : mixed
Parameters
- $e : Exception
Tags
Return values
mixed —doMailTransaction()
Send an email to the given recipients from the given reverse path
private
doMailTransaction(Message $message, string $reversePath, array<string|int, mixed> $recipients) : int
Parameters
- $message : Message
- $reversePath : string
- $recipients : array<string|int, mixed>
Return values
int —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(string $ehloResponse) : array<string|int, mixed>
Parameters
- $ehloResponse : string
Return values
array<string|int, mixed> —isFqdn()
Determine is the $hostname is a fully-qualified name
private
isFqdn(string $hostname) : bool
Parameters
- $hostname : string
Return values
bool —lookupHostname()
Try to determine the hostname of the server this is run on
private
lookupHostname() : mixed
Return values
mixed —sendBcc()
Send a message to all Bcc: recipients
private
sendBcc(Message $message, string $reversePath, array<string|int, mixed> $bcc) : int
Parameters
- $message : Message
- $reversePath : string
- $bcc : array<string|int, mixed>
Return values
int —sendTo()
Send a message to the given To: recipients
private
sendTo(Message $message, string $reversePath, array<string|int, mixed> $to) : int
Parameters
- $message : Message
- $reversePath : string
- $to : array<string|int, mixed>
Return values
int —setHandlerParams()
Set parameters which are used by each extension handler
private
setHandlerParams() : mixed
Return values
mixed —sortHandlers()
Custom sort for extension handler ordering
private
sortHandlers(HandlerInterface $a, HandlerInterface $b) : int
Parameters
- $a : HandlerInterface
- $b : HandlerInterface