PHP Class Swift_Transport_AbstractSmtpTransport, Halite

Author: Chris Corbyn
Inheritance: implements Swift_Transport
Exibir arquivo Open project: HaliteChallenge/Halite Class Usage Examples

Protected Properties

Property Type Description
$_buffer Input-Output buffer for sending/receiving SMTP commands and responses
$_domain The domain name to use in HELO command
$_eventDispatcher The event dispatching layer
$_sourceIp Source Ip
$_started Connection status

Public Methods

Method Description
__construct ( Swift_Transport_IoBuffer $buf, Swift_Events_EventDispatcher $dispatcher ) Creates a new EsmtpTransport using the given I/O buffer.
__destruct ( ) Destructor.
executeCommand ( string $command, int[] $codes = [], string[] &$failures = null ) : string Run a command against the buffer, expecting the given response codes.
getBuffer ( ) : Swift_Transport_IoBuffer Get the IoBuffer where read/writes are occurring.
getLocalDomain ( ) : string Get the name of the domain Swift will identify as.
getSourceIp ( ) : string Returns the IP used to connect to the destination.
isStarted ( ) : boolean Test if an SMTP connection has been established.
registerPlugin ( Swift_Events_EventListener $plugin ) Register a plugin.
reset ( ) Reset the current mail transaction.
send ( Swift_Mime_Message $message, string[] &$failedRecipients = null ) : integer Send the given Message.
setLocalDomain ( string $domain ) : Swift_Transport_AbstractSmtpTransport Set the name of the local domain which Swift will identify itself as.
setSourceIp ( string $source ) Sets the source IP.
start ( ) Start the SMTP connection.
stop ( ) Stop the SMTP connection.

Protected Methods

Method Description
_assertResponseCode ( $response, $wanted ) Throws an Exception if a response code is incorrect
_doDataCommand ( ) Send the DATA command
_doHeloCommand ( ) Send the HELO welcome
_doMailFromCommand ( $address ) Send the MAIL FROM command
_doRcptToCommand ( $address ) Send the RCPT TO command
_getBufferParams ( ) Return an array of params for the Buffer
_getFullResponse ( $seq ) Get an entire multi-line response using its sequence number
_getReversePath ( Swift_Mime_Message $message ) Determine the best-use reverse path for this message
_readGreeting ( ) Read the opening SMTP greeting
_streamMessage ( Swift_Mime_Message $message ) Stream the contents of the message over the buffer
_throwException ( Swift_TransportException $e ) Throw a TransportException, first sending it to any listeners

Private Methods

Method Description
_doMailTransaction ( $message, $reversePath, array $recipients, array &$failedRecipients ) Send an email to the given recipients from the given reverse path
_isFqdn ( $hostname ) Determine is the $hostname is a fully-qualified name
_lookupHostname ( ) Try to determine the hostname of the server this is run on
_sendBcc ( Swift_Mime_Message $message, $reversePath, array $bcc, array &$failedRecipients ) Send a message to all Bcc: recipients
_sendTo ( Swift_Mime_Message $message, $reversePath, array $to, array &$failedRecipients ) Send a message to the given To: recipients

Method Details

__construct() public method

Creates a new EsmtpTransport using the given I/O buffer.
public __construct ( Swift_Transport_IoBuffer $buf, Swift_Events_EventDispatcher $dispatcher )
$buf Swift_Transport_IoBuffer
$dispatcher Swift_Events_EventDispatcher

__destruct() public method

Destructor.
public __destruct ( )

_assertResponseCode() protected method

Throws an Exception if a response code is incorrect
protected _assertResponseCode ( $response, $wanted )

_doDataCommand() protected method

Send the DATA command
protected _doDataCommand ( )

_doHeloCommand() protected method

Send the HELO welcome
protected _doHeloCommand ( )

_doMailFromCommand() protected method

Send the MAIL FROM command
protected _doMailFromCommand ( $address )

_doRcptToCommand() protected method

Send the RCPT TO command
protected _doRcptToCommand ( $address )

_getBufferParams() abstract protected method

Return an array of params for the Buffer
abstract protected _getBufferParams ( )

_getFullResponse() protected method

Get an entire multi-line response using its sequence number
protected _getFullResponse ( $seq )

_getReversePath() protected method

Determine the best-use reverse path for this message
protected _getReversePath ( Swift_Mime_Message $message )
$message Swift_Mime_Message

_readGreeting() protected method

Read the opening SMTP greeting
protected _readGreeting ( )

_streamMessage() protected method

Stream the contents of the message over the buffer
protected _streamMessage ( Swift_Mime_Message $message )
$message Swift_Mime_Message

_throwException() protected method

Throw a TransportException, first sending it to any listeners
protected _throwException ( Swift_TransportException $e )
$e Swift_TransportException

executeCommand() public method

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.
public executeCommand ( string $command, int[] $codes = [], string[] &$failures = null ) : string
$command string
$codes int[]
$failures string[] An array of failures by-reference
return string

getBuffer() public method

Get the IoBuffer where read/writes are occurring.
public getBuffer ( ) : Swift_Transport_IoBuffer
return Swift_Transport_IoBuffer

getLocalDomain() public method

Get the name of the domain Swift will identify as.
public getLocalDomain ( ) : string
return string

getSourceIp() public method

Returns the IP used to connect to the destination.
public getSourceIp ( ) : string
return string

isStarted() public method

Test if an SMTP connection has been established.
public isStarted ( ) : boolean
return boolean

registerPlugin() public method

Register a plugin.
public registerPlugin ( Swift_Events_EventListener $plugin )
$plugin Swift_Events_EventListener

reset() public method

Reset the current mail transaction.
public reset ( )

send() public method

Recipient/sender data will be retrieved from the Message API. The return value is the number of recipients who were accepted for delivery.
public send ( Swift_Mime_Message $message, string[] &$failedRecipients = null ) : integer
$message Swift_Mime_Message
$failedRecipients string[] An array of failures by-reference
return integer

setLocalDomain() public method

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]).
public setLocalDomain ( string $domain ) : Swift_Transport_AbstractSmtpTransport
$domain string
return Swift_Transport_AbstractSmtpTransport

setSourceIp() public method

Sets the source IP.
public setSourceIp ( string $source )
$source string

start() public method

Start the SMTP connection.
public start ( )

stop() public method

Stop the SMTP connection.
public stop ( )

Property Details

$_buffer protected_oe property

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

$_domain protected_oe property

The domain name to use in HELO command
protected $_domain

$_eventDispatcher protected_oe property

The event dispatching layer
protected $_eventDispatcher

$_sourceIp protected_oe property

Source Ip
protected $_sourceIp

$_started protected_oe property

Connection status
protected $_started