Class Swift

Description

Swift is the central component in the Swift library.

Located in /Swift.php (line 31)


	
			
Class Constant Summary
Variable Summary
Method Summary
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)
Swift __construct ( $conn, [string $domain = false], [int $options = null])
void removePlugin (string $id)
void reset ()
int send ( $message, mixed $recipients, mixed $from)
void setConnectionExtensions ( $list)
void setDomain (string $name)
void setOptions (int $options)
Variables
Swift_Connection $connection = null (line 57)

The connection object currently active

  • access: public
string $domain = null (line 62)

The domain name of this server (should technically be a FQDN)

  • access: protected
array $listeners = array() (line 72)

Loaded plugins, separated into containers according to roles

  • access: protected
int $options (line 67)

Flags to change the behaviour of Swift

  • access: protected
Methods
assertCorrectResponse (line 242)

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

  • access: protected
  • 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 121)

Add a new plugin to Swift

Plugins must implement one or more event listeners

  • access: public
void attachPlugin ( $plugin,  $id)
batchSend (line 484)

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
  • access: public
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 288)

Execute a command against the service and get the response

  • return: The server's response (could be multiple lines)
  • access: public
  • throws: Swift_ConnectionException 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. -1 indicates that no response is wanted.
connect (line 214)

Attempt to establish a connection with the service

  • access: public
  • throws: Swift_ConnectionException If the connection cannot be established or behaves oddly
void connect ()
disconnect (line 229)

Disconnect from the MTA

  • access: public
  • throws: Swift_ConnectionException If the connection will not stop
void disconnect ()
getOptions (line 198)

Get the current options set (as bits)

  • access: public
int getOptions ()
getPlugin (line 135)

Get an attached plugin if it exists

  • access: public
Swift_Event_Listener getPlugin (string $id)
  • string $id: The id of the plugin
handshake (line 258)

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

  • access: protected
  • throws: Swift_ConnectionException If conversation is not going very well
void handshake ( $greeting)
hasOption (line 181)

Check if an option flag has been set

  • access: public
boolean hasOption (string $option)
  • string $option: Option name
initializeEventListenerContainer (line 107)

Populate the listeners array with the defined listeners ready for plugins

  • access: protected
void initializeEventListenerContainer ()
notifyListeners (line 163)

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

  • access: public
void notifyListeners (Swift_Events $e, string $type)
  • Swift_Events $e: The event to send
  • string $type: The type of event
Constructor __construct (line 81)

Constructor

  • access: public
  • throws: Swift_ConnectionException 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
removePlugin (line 147)

Remove a plugin attached under the ID of $id

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

Reset a conversation which has gone badly

  • access: public
  • throws: Swift_ConnectionException If the service refuses to reset
void reset ()
send (line 329)

Send a message to any number of recipients

  • return: The number of successful recipients
  • access: public
  • throws: Swift_ConnectionException 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 270)

Set the extensions which the service reports in the connection object

  • access: protected
void setConnectionExtensions ( $list)
setDomain (line 206)

Set the FQDN of this server as it will identify itself

  • access: public
void setDomain (string $name)
  • string $name: The FQDN of the server
setOptions (line 190)

Adjust the options flags

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

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

Constant to ask Swift to start logging

NO_HANDSHAKE = 4 (line 44)

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

NO_POST_CONNECT = 16 (line 52)

Constant to prevent postConnect() being run in the connection

NO_START = 2 (line 40)

Constant to flag Swift not to try and connect upon instantiation

VERSION = "3.3.2" (line 36)

The version number.

Documentation generated on Wed, 26 Mar 2008 20:33:11 +1100 by phpDocumentor 1.3.1