TYPO3  7.6
Public Member Functions | Protected Member Functions | Protected Attributes | Private Member Functions | List of all members
Swift_Transport_AbstractSmtpTransport Class Reference
Inheritance diagram for Swift_Transport_AbstractSmtpTransport:
Swift_Transport Swift_Transport_EsmtpTransport Swift_Transport_SendmailTransport Swift_SmtpTransport Swift_SendmailTransport

Public Member Functions

 __construct (Swift_Transport_IoBuffer $buf, Swift_Events_EventDispatcher $dispatcher)
 
 setLocalDomain ($domain)
 
 getLocalDomain ()
 
 setSourceIp ($source)
 
 getSourceIp ()
 
 start ()
 
 isStarted ()
 
 send (Swift_Mime_Message $message, &$failedRecipients=null)
 
 stop ()
 
 registerPlugin (Swift_Events_EventListener $plugin)
 
 reset ()
 
 getBuffer ()
 
 executeCommand ($command, $codes=array(), &$failures=null)
 
 __destruct ()
 

Protected Member Functions

 _getBufferParams ()
 
 _readGreeting ()
 
 _doHeloCommand ()
 
 _doMailFromCommand ($address)
 
 _doRcptToCommand ($address)
 
 _doDataCommand ()
 
 _streamMessage (Swift_Mime_Message $message)
 
 _getReversePath (Swift_Mime_Message $message)
 
 _throwException (Swift_TransportException $e)
 
 _assertResponseCode ($response, $wanted)
 
 _getFullResponse ($seq)
 

Protected Attributes

 $_buffer
 
 $_started = false
 
 $_domain = '[127.0.0.1]'
 
 $_eventDispatcher
 
 $_sourceIp
 

Private Member Functions

 _doMailTransaction ($message, $reversePath, array $recipients, array &$failedRecipients)
 
 _sendTo (Swift_Mime_Message $message, $reversePath, array $to, array &$failedRecipients)
 
 _sendBcc (Swift_Mime_Message $message, $reversePath, array $bcc, array &$failedRecipients)
 
 _lookupHostname ()
 
 _isFqdn ($hostname)
 

Detailed Description

Sends Messages over SMTP.

Author
Chris Corbyn

Definition at line 16 of file AbstractSmtpTransport.php.

Constructor & Destructor Documentation

__construct ( Swift_Transport_IoBuffer  $buf,
Swift_Events_EventDispatcher  $dispatcher 
)

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

Parameters
Swift_Transport_IoBuffer$buf
Swift_Events_EventDispatcher$dispatcher

Definition at line 42 of file AbstractSmtpTransport.php.

References _lookupHostname().

__destruct ( )

Destructor.

Definition at line 486 of file AbstractSmtpTransport.php.

References stop().

Member Function Documentation

_assertResponseCode (   $response,
  $wanted 
)
protected

Throws an Exception if a response code is incorrect

Definition at line 371 of file AbstractSmtpTransport.php.

References $response, and _throwException().

Referenced by _readGreeting(), and executeCommand().

_doDataCommand ( )
protected

Send the DATA command

Definition at line 317 of file AbstractSmtpTransport.php.

References executeCommand().

Referenced by _doMailTransaction().

_doHeloCommand ( )
protected

Send the HELO welcome

Definition at line 293 of file AbstractSmtpTransport.php.

References executeCommand().

Referenced by start().

_doMailFromCommand (   $address)
protected

Send the MAIL FROM command

Definition at line 301 of file AbstractSmtpTransport.php.

References executeCommand().

Referenced by _doMailTransaction().

_doMailTransaction (   $message,
  $reversePath,
array  $recipients,
array &  $failedRecipients 
)
private

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

Definition at line 413 of file AbstractSmtpTransport.php.

References _doDataCommand(), _doMailFromCommand(), _doRcptToCommand(), _streamMessage(), and reset().

Referenced by _sendBcc(), and _sendTo().

_doRcptToCommand (   $address)
protected

Send the RCPT TO command

Definition at line 309 of file AbstractSmtpTransport.php.

References executeCommand().

Referenced by _doMailTransaction().

_getBufferParams ( )
abstractprotected

Return an array of params for the Buffer

Referenced by start().

_getFullResponse (   $seq)
protected

Get an entire multi-line response using its sequence number

Definition at line 392 of file AbstractSmtpTransport.php.

References $response, and _throwException().

Referenced by _readGreeting(), and executeCommand().

_getReversePath ( Swift_Mime_Message  $message)
protected

Determine the best-use reverse path for this message

Definition at line 337 of file AbstractSmtpTransport.php.

References elseif, Swift_Mime_Message\getFrom(), Swift_Mime_Message\getReturnPath(), Swift_Mime_Message\getSender(), and reset().

Referenced by Swift_Transport_SendmailTransport\send(), and send().

_isFqdn (   $hostname)
private

Determine is the $hostname is a fully-qualified name

Definition at line 473 of file AbstractSmtpTransport.php.

Referenced by _lookupHostname().

_lookupHostname ( )
private

Try to determine the hostname of the server this is run on

Definition at line 462 of file AbstractSmtpTransport.php.

References _isFqdn(), and elseif.

Referenced by __construct().

_readGreeting ( )
protected

Read the opening SMTP greeting

Definition at line 287 of file AbstractSmtpTransport.php.

References _assertResponseCode(), and _getFullResponse().

Referenced by start().

_sendBcc ( Swift_Mime_Message  $message,
  $reversePath,
array  $bcc,
array &  $failedRecipients 
)
private

Send a message to all Bcc: recipients

Definition at line 448 of file AbstractSmtpTransport.php.

References _doMailTransaction(), and Swift_Mime_Message\setBcc().

Referenced by send().

_sendTo ( Swift_Mime_Message  $message,
  $reversePath,
array  $to,
array &  $failedRecipients 
)
private

Send a message to the given To: recipients

Definition at line 437 of file AbstractSmtpTransport.php.

References _doMailTransaction().

Referenced by send().

_streamMessage ( Swift_Mime_Message  $message)
protected

Stream the contents of the message over the buffer

Definition at line 323 of file AbstractSmtpTransport.php.

References _throwException(), executeCommand(), and Swift_Mime_MimeEntity\toByteStream().

Referenced by _doMailTransaction().

_throwException ( Swift_TransportException  $e)
protected

Throw a TransportException, first sending it to any listeners

Definition at line 358 of file AbstractSmtpTransport.php.

Referenced by _assertResponseCode(), Swift_Transport_EsmtpTransport\_doHeloCommand(), _getFullResponse(), _streamMessage(), Swift_Transport_SendmailTransport\send(), send(), start(), and stop().

executeCommand (   $command,
  $codes = array(),
$failures = null 
)

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

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
string$command
int[]$codes
string[]$failures An array of failures by-reference
Returns
string

Definition at line 273 of file AbstractSmtpTransport.php.

References $response, _assertResponseCode(), and _getFullResponse().

Referenced by _doDataCommand(), _doHeloCommand(), _doMailFromCommand(), _doRcptToCommand(), _streamMessage(), reset(), and stop().

getBuffer ( )

Get the IoBuffer where read/writes are occurring.

Returns
Swift_Transport_IoBuffer

Definition at line 256 of file AbstractSmtpTransport.php.

References $_buffer.

Referenced by Swift_Transport_SendmailTransport\send().

getLocalDomain ( )

Get the name of the domain Swift will identify as.

Returns
string

Definition at line 74 of file AbstractSmtpTransport.php.

References $_domain.

getSourceIp ( )

Returns the IP used to connect to the destination.

Returns
string

Definition at line 94 of file AbstractSmtpTransport.php.

References $_sourceIp.

isStarted ( )

Test if an SMTP connection has been established.

Returns
bool

Implements Swift_Transport.

Definition at line 133 of file AbstractSmtpTransport.php.

References $_started.

registerPlugin ( Swift_Events_EventListener  $plugin)

Register a plugin.

Parameters
Swift_Events_EventListener$plugin

Implements Swift_Transport.

Definition at line 238 of file AbstractSmtpTransport.php.

reset ( )

Reset the current mail transaction.

Definition at line 246 of file AbstractSmtpTransport.php.

References executeCommand().

Referenced by _doMailTransaction(), and _getReversePath().

send ( Swift_Mime_Message  $message,
$failedRecipients = null 
)

Send the given Message.

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

Parameters
Swift_Mime_Message$message
string[]$failedRecipients An array of failures by-reference
Returns
int

Implements Swift_Transport.

Definition at line 149 of file AbstractSmtpTransport.php.

References _getReversePath(), _sendBcc(), _sendTo(), _throwException(), elseif, Swift_Mime_Message\generateId(), Swift_Mime_Message\getBcc(), Swift_Mime_Message\getCc(), Swift_Mime_Message\getTo(), Swift_Events_SendEvent\RESULT_FAILED, Swift_Events_SendEvent\RESULT_SUCCESS, Swift_Events_SendEvent\RESULT_TENTATIVE, and Swift_Mime_Message\setBcc().

setLocalDomain (   $domain)

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

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
string$domain
Returns
Swift_Transport_AbstractSmtpTransport

Definition at line 62 of file AbstractSmtpTransport.php.

setSourceIp (   $source)

Sets the source IP.

Parameters
string$source

Definition at line 84 of file AbstractSmtpTransport.php.

start ( )

Start the SMTP connection.

Implements Swift_Transport.

Definition at line 102 of file AbstractSmtpTransport.php.

References _doHeloCommand(), _getBufferParams(), _readGreeting(), and _throwException().

stop ( )

Stop the SMTP connection.

Implements Swift_Transport.

Definition at line 205 of file AbstractSmtpTransport.php.

References _throwException(), and executeCommand().

Referenced by __destruct().

Member Data Documentation

$_buffer
protected

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

Definition at line 19 of file AbstractSmtpTransport.php.

Referenced by getBuffer().

$_domain = '[127.0.0.1]'
protected

The domain name to use in HELO command

Definition at line 25 of file AbstractSmtpTransport.php.

Referenced by getLocalDomain().

$_eventDispatcher
protected

The event dispatching layer

Definition at line 28 of file AbstractSmtpTransport.php.

$_sourceIp
protected

Source Ip

Definition at line 31 of file AbstractSmtpTransport.php.

Referenced by getSourceIp().

$_started = false
protected

Connection status

Definition at line 22 of file AbstractSmtpTransport.php.

Referenced by isStarted().