Class Swift

Description

Swift is the central component in the Swift library.

Located in /Swift.php (line 29)


	
			
Class Constant Summary
Method Summary
Swift __construct ( $conn, [string $domain = false], [int $options = null])
void assertCorrectResponse ( $response, int $codes)
void attachPlugin ( $plugin,  $id)
int batchSend ( $message, Swift_RecipientList $to, Swift_Address $from)
Swift_Events_ResponseEvent command (string $command, [int $code = null])
void connect ()
void disconnect ()
int getOptions ()
Swift_Event_Listener getPlugin (string $id)
void handshake ( $greeting)
boolean hasOption (string $option)
void notifyListeners (Swift_Events $e, string $type)
void removePlugin (string $id)
void reset ()
int send ( $message, mixed $recipients, mixed $from)
void setConnectionExtensions ( $list)
void setDomain (string $name)
void setLogger ( $logger)
void setOptions (int $options)
Methods
Constructor __construct (line 80)

Constructor

  • throws: Swift_Connection_Exception If a connection cannot be established or the connection is behaving incorrectly
Swift __construct ( $conn, [string $domain = false], [int $options = null])
  • Swift_Connection $conn: The connection object to deal with I/O
  • string $domain: The domain name of this server (the client) as a FQDN
  • int $options: Optional flags
assertCorrectResponse (line 246)

Throws an exception if the response code wanted does not match the one returned

  • throws: Swift_BadResponseException If the code does not match
void assertCorrectResponse ( $response, int $codes)
  • Swift_Event_ResponseEvent $response: The full response from the service
  • int $codes: The 3 digit response code wanted
attachPlugin (line 117)

Add a new plugin to Swift

Plugins must implement one or more event listeners

void attachPlugin ( $plugin,  $id)
  • Swift_Events_Listener $plugin: The plugin to load
  • $id
batchSend (line 459)

Send a message to a batch of recipients.

Unlike send() this method ignores Cc and Bcc recipients and does not reveal every recipients' address in the headers

  • return: The number of successful recipients
  • throws: Swift_Connection_Exception If the entire batch fails
int batchSend ( $message, Swift_RecipientList $to, Swift_Address $from)
  • Swift_Message $message: The message to send (leave out the recipient headers unless you are deliberately overriding them)
  • Swift_RecipientList $to: The addresses to send to
  • Swift_Address $from: The address the mail is from (sender)
command (line 290)

Execute a command against the service and get the response

  • return: The server's response (could be multiple lines)
  • throws: Swift_Connection_Exception If a code was expected but does not match the one returned
Swift_Events_ResponseEvent command (string $command, [int $code = null])
  • string $command: The command to execute (leave off any CRLF!!!)
  • int $code: The code to check for in the response, if any
connect (line 218)

Attempt to establish a connection with the service

  • throws: Swift_Connection_Exception If the connection cannot be established or behaves oddly
void connect ()
disconnect (line 233)

Disconnect from the MTA

  • throws: Swift_Connection_Exception If the connection will not stop
void disconnect ()
getOptions (line 202)

Get the current options set (as bits)

int getOptions ()
getPlugin (line 131)

Get an attached plugin if it exists

Swift_Event_Listener getPlugin (string $id)
  • string $id: The id of the plugin
handshake (line 261)

Have a polite greeting with the server and work out what it's capable of

  • throws: Swift_Connection_Exception If conversation is not going very well
void handshake ( $greeting)
hasOption (line 185)

Check if an option flag has been set

boolean hasOption (string $option)
  • string $option: Option name
initializeEventListenerContainer (line 103)

Populate the listeners array with the defined listeners ready for plugins

void initializeEventListenerContainer ()
notifyListeners (line 159)

Send a new type of event to all objects which are listening for it

void notifyListeners (Swift_Events $e, string $type)
  • Swift_Events $e: The event to send
  • string $type: The type of event
removePlugin (line 143)

Remove a plugin attached under the ID of $id

void removePlugin (string $id)
  • string $id: The ID of the plugin
reset (line 314)

Reset a conversation which has gone badly

  • throws: Swift_Connection_Exception If the service refuses to reset
void reset ()
send (line 326)

Send a message to any number of recipients

  • return: The number of successful recipients
  • throws: Swift_Connection_Exception If sending fails for any reason.
int send ( $message, mixed $recipients, mixed $from)
  • Swift_Message $message: The message to send. This does not need to (and shouldn't really) have any of the recipient headers set.
  • mixed $recipients: The recipients to send to. Can be a string, Swift_Address or Swift_RecipientList. Note that all addresses apart from Bcc recipients will appear in the message headers
  • mixed $from: The address to send the message from. Can either be a string or an instance of Swift_Address.
setConnectionExtensions (line 272)

Set the extensions which the service reports in the connection object

void setConnectionExtensions ( $list)
setDomain (line 210)

Set the FQDN of this server as it will identify itself

void setDomain (string $name)
  • string $name: The FQDN of the server
setLogger (line 176)

Set the logger to use

void setLogger ( $logger)
  • Swift_Log $logger: The instantiated logger
setOptions (line 194)

Adjust the options flags

E.g. $obj->setOptions(Swift::NO_START | Swift::NO_HANDSHAKE)

void setOptions (int $options)
  • int $options: The bits to set
Class Constants
ENABLE_LOGGING = 8 (line 42)

Constant to ask Swift to start logging

NO_HANDSHAKE = 4 (line 38)

Constant to tell Swift not to perform the standard SMTP handshake upon connect

NO_POST_CONNECT = 16 (line 46)

Constant to prevent postConnect() being run in the connection

NO_START = 2 (line 34)

Constant to flag Swift not to try and connect upon instantiation

Documentation generated on Tue, 06 Mar 2007 23:32:28 +0000 by phpDocumentor 1.3.1