Class EasySwift

Description

EasySwift: Facade for Swift Mailer Version 3.

Provides (most of) the API from older versions of Swift, wrapped around the new version 3 API. Due to the popularity of the new API, EasySwift will not be around indefinitely.

Located in /EasySwift.php (line 32)


	
			
Variable Summary
Method Summary
EasySwift __construct ( $connection, [string $domain = null])
boolean addAttachment (mixed $data, [string $filename = null], [string $type = "application/octet-stream"], [string $encoding = null])
boolean addBcc (mixed $address)
boolean addCc (mixed $address)
void addHeaders (string $string)
string addImage (mixed $input)
void addPart (mixed $body, [string $type = "text/plain"], [string $encoding = null], [string $charset = null])
boolean addRecipients (mixed $address, string $type)
boolean addTo (mixed $address)
boolean authenticate (string $username, string $password)
void autoFlush ([boolean $flush = true])
boolean close ()
string command (string $command)
void connect ()
void dumpLog ()
string embedFile (mixed $data, [string $type = "application/octet-stream"], [string $filename = null], [string $cid = null])
void flush ()
boolean flushAttachments ()
void flushBcc ()
void flushCc ()
void flushErrors ()
void flushHeaders ()
boolean flushParts ()
void flushTo ()
array getBccAddresses ()
array getCcAddresses ()
string getCharset ()
array getErrors ()
string getLastError ()
string getMimeWarning ()
array getReplyTo ()
string getReturnPath ()
array getToAddresses ()
void getTransactions ()
void handshake ()
boolean hasFailed ()
boolean isConnected ()
void loadAuthenticator ( $auth)
string loadPlugin ( $plugin, [string $name = null])
void newMessage ([ $msg = false])
void newRecipientList ([ $list = false])
boolean removePlugin (string $name)
void requestReadReceipt ([boolean $request = true])
int send (mixed $recipients, mixed $from, string $subject, [string $body = null])
boolean setCharset (string $charset)
void setError (string $msg)
void setHeader (string $name, string $value)
void setHeaderAttribute (string $name, string $attribute, string $value)
void setHeaderEncoding ([string $mode = "B"])
void setMaxLogSize (int $size)
void setMimeWarning (string $text)
void setPriority (int $priority)
void setReplyTo (mixed $address)
void setReturnPath (mixed $address)
void useAutoLineResizing ([int $size = 1000])
void useExactCopy ([boolean $bool = true])
void useLogging ([boolean $use = true])
Variables
array $attachmentIds = array() (line 79)

A list of all the IDs of the attachments add to the message

  • access: protected
boolean $autoFlush = true (line 69)

If EasySwift should get rid of the message and recipients once it's done sending

  • access: protected
array $errors = array() (line 94)

The list of errors handled at runtime

  • access: public
boolean $exactCopy = false (line 64)

If all recipients should get the same copy of the message, including headers

This is already implied if any Cc or Bcc recipients are set

  • access: protected
boolean $failed = false (line 43)

This value becomes set to true when Swift fails

  • access: public
string $lastError = null (line 99)

The last error received

  • access: public
string $lastResponse = "" (line 84)

The last response received from the server

  • access: public
Swift_Message $message = null (line 53)

An instance of Swift_Message

  • access: public
array $partIds = array() (line 74)

A list of the IDs of all parts added to the message

  • access: protected
int $pluginCount = 0 (line 48)

The number of loaded plugins

  • access: protected
Swift_RecipientList $recipients = null (line 58)

An address list to send to (Cc, Bcc, To..)

  • access: public
int $responseCode = 0 (line 89)

The 3 digit code in the last response received from the server

  • access: public
Swift $swift = null (line 38)

The instance of Swift this class wrappers

  • access: public
Methods
Constructor __construct (line 106)

Constructor

  • access: public
EasySwift __construct ( $connection, [string $domain = null])
  • Swift_Connection $connection: The connection to use
  • string $domain: The domain name of this server (not the SMTP server)
addAttachment (line 739)

Add a new attachment to the message

  • access: public
boolean addAttachment (mixed $data, [string $filename = null], [string $type = "application/octet-stream"], [string $encoding = null])
  • mixed $data: The attachment to add. If this is a string it's used as the file contents. If it's an instance of Swift_Message_Attachment it's used as the entire part. If it's an instance of Swift_File it's used as the contents.
  • string $filename: Filename, optional
  • string $type: Content-type. Default application/octet-stream
  • string $encoding: The encoding used (default is base64)
addBcc (line 583)

Add Bcc: recipients to the email

  • access: public
boolean addBcc (mixed $address)
  • mixed $address: Bcc address(es)
addCc (line 558)

Add Cc: recipients to the email

  • access: public
boolean addCc (mixed $address)
  • mixed $address: Cc address(es)
addHeaders (line 859)

Add headers to the message

  • access: public
  • deprecated:
void addHeaders (string $string)
  • string $string: The message headers to append, separated by CRLF
addImage (line 770)

Embed an image into the message and get the src attribute for HTML

Returns FALSE on failure

  • access: public
string addImage (mixed $input)
  • mixed $input: The path to the image, a Swift_Message_Image object or a Swift_File object
addPart (line 710)

Add a new MIME part to the message

  • access: public
void addPart (mixed $body, [string $type = "text/plain"], [string $encoding = null], [string $charset = null])
  • mixed $body: The part to add. If this is a string it's used as the body. If it's an instance of Swift_Message_Part it's used as the entire part
  • string $type: Content-type, default text/plain
  • string $encoding: The encoding used (default is to let Swift decide)
  • string $charset: The charset to use (default is to let swift decide)
addRecipients (line 609)

Add recipients to the email

  • access: protected
boolean addRecipients (mixed $address, string $type)
  • mixed $address: Address(es)
  • string $type: Recipient type (To, Cc, Bcc)
addTo (line 533)

Add To: recipients to the email

  • access: public
boolean addTo (mixed $address)
  • mixed $address: To address(es)
authenticate (line 414)

Authenticate with SMTP authentication

  • access: public
  • throws: Exception If the wrong connection is used
boolean authenticate (string $username, string $password)
  • string $username: The SMTP username
  • string $password: The SMTP password
autoFlush (line 156)

Turn automatic flsuhing on or off.

This in ON by deault. It removes the message and all parts after sending.

  • access: public
void autoFlush ([boolean $flush = true])
  • boolean $flush
close (line 322)

Close the connection to the MTA

  • access: public
boolean close ()
command (line 340)

Send a command to Swift and get a response

  • access: public
string command (string $command)
  • string $command: The command to send (leave of CRLF)
connect (line 297)

Connect to the MTA if not already connected

  • access: public
void connect ()
dumpLog (line 200)

Dump the contents of the log to the browser The log contains some < and > characters so you may need to view source Note that this method dumps data to the browser, it does NOT return anything.

  • access: public
void dumpLog ()
embedFile (line 816)

Embed an inline file into the message, such as a Image or MIDI file

  • access: public
string embedFile (mixed $data, [string $type = "application/octet-stream"], [string $filename = null], [string $cid = null])
  • mixed $data: The file contents, Swift_File object or Swift_Message_EmbeddedFile object
  • string $type: The content-type of the file, optional
  • string $filename: The filename to use, optional
  • string $cid: the Content-ID to use, optional
flush (line 650)

Flush message, recipients and headers

  • access: public
void flush ()
flushAttachments (line 246)

Clear out all attachments

  • access: public
boolean flushAttachments ()
flushBcc (line 599)

Clear out all Bcc: recipients

  • access: public
void flushBcc ()
flushCc (line 574)

Clear out all Cc: recipients

  • access: public
void flushCc ()
flushErrors (line 146)

Clear the current list of errors

  • access: public
void flushErrors ()
flushHeaders (line 265)

Clear out all message headers

  • access: public
  • deprecated:
void flushHeaders ()
flushParts (line 227)

Clear out all message parts

  • access: public
boolean flushParts ()
flushTo (line 549)

Clear out all To: recipients

  • access: public
void flushTo ()
getBccAddresses (line 592)

Get an array of Bcc addresses

This currently returns an array of Swift_Address objects and may be simplified to an array of strings in later versions

  • access: public
array getBccAddresses ()
getCcAddresses (line 567)

Get an array of Cc addresses

This currently returns an array of Swift_Address objects and may be simplified to an array of strings in later versions

  • access: public
array getCcAddresses ()
getCharset (line 699)

Get the charset of the charset to use in the message

  • access: public
string getCharset ()
getErrors (line 131)

Get the full list of errors

  • access: public
array getErrors ()
getFailedRecipients (line 659)

Get a list of any addresses which have failed since instantiation

  • access: public
array getFailedRecipients ()
getLastError (line 139)

Get the last error that occured

  • access: public
string getLastError ()
getMimeWarning (line 676)

Get the currently set MIME warning (seen by old clients)

  • access: public
string getMimeWarning ()
getPlugin (line 370)

Get a reference to the plugin identified by $name

  • access: public
Swift_Events_Listener getPlugin (string $name)
  • string $name: the ID of the plugin
getReplyTo (line 520)

Get the reply-to address(es) as an array of strings

  • access: public
array getReplyTo ()
getReturnPath (line 500)

Get the return-path address as a string

  • access: public
string getReturnPath ()
getToAddresses (line 542)

Get an array of To addresses

This currently returns an array of Swift_Address objects and may be simplified to an array of strings in later versions

  • access: public
array getToAddresses ()
getTransactions (line 191)

Dump the log contents

  • access: public
  • deprecated:
void getTransactions ()
handshake (line 314)

Perform the SMTP greeting process (don't do this unless you understand why you're doing it)

  • access: public
void handshake ()
hasFailed (line 282)

Check if Swift has failed or not

This facade stops processing if so

  • access: public
boolean hasFailed ()
isConnected (line 290)

Check if the current connection is open or not

  • access: public
boolean isConnected ()
loadAuthenticator (line 399)

Load in a new authentication mechanism for SMTP

This needn't be called since Swift will locate any available in Swift/Authenticator/*.php

  • access: public
  • throws: Exception If the wrong connection is used
void loadAuthenticator ( $auth)
loadPlugin (line 358)

Add a new plugin to respond to events

  • return: The ID of the plugin
  • access: public
string loadPlugin ( $plugin, [string $name = null])
  • Swift_Events_Listener $plugin: The plugin to load
  • string $name: The ID to identify the plugin by if needed
newMessage (line 216)

Reset the current message and start a fresh one

  • access: public
void newMessage ([ $msg = false])
  • $msg
newRecipientList (line 272)

Reset the current list of recipients and start a new one

  • access: public
void newRecipientList ([ $list = false])
  • $list
removePlugin (line 384)

Remove the plugin identified by $name

  • access: public
boolean removePlugin (string $name)
  • string $name: The ID of the plugin
requestReadReceipt (line 483)

Request for a read recipient to be sent to the reply-to address

  • access: public
void requestReadReceipt ([boolean $request = true])
  • boolean $request
send (line 922)

Send an email to a number of recipients

Returns the number of successful recipients, or FALSE on failure

  • access: public
int send (mixed $recipients, mixed $from, string $subject, [string $body = null])
  • mixed $recipients: The recipients to send to. One of string, array, 2-dimensional array or Swift_Address
  • mixed $from: The address to send from. string or Swift_Address
  • string $subject: The message subject
  • string $body: The message body, optional
setCharset (line 685)

Set the charset of the charset to use in the message

  • access: public
boolean setCharset (string $charset)
  • string $charset: The charset (e.g. utf-8, iso-8859-1 etc)
setError (line 123)

Set an error message

  • access: public
void setError (string $msg)
  • string $msg: Error message
setHeader (line 897)

Set a header in the message

  • access: public
  • see: {addHeaderAttribute}
void setHeader (string $name, string $value)
  • string $name: The name of the header
  • string $value: The value of the header (without attributes)
setHeaderAttribute (line 908)

Set an attribute in the message headers

For example charset in Content-Type: text/html; charset=utf-8 set by $swift->setHeaderAttribute("Content-Type", "charset", "utf-8")

  • access: public
void setHeaderAttribute (string $name, string $attribute, string $value)
  • string $name: The name of the header
  • string $attribute: The name of the attribute
  • string $value: The value of the attribute
setHeaderEncoding (line 460)

Set the encoding used in the message header

The encoding can be one of Q (quoted-printable) or B (base64)

  • access: public
void setHeaderEncoding ([string $mode = "B"])
  • string $mode: The encoding to use
setMaxLogSize (line 164)

Set the maximum size of the log

  • access: public
void setMaxLogSize (int $size)
  • int $size
setMimeWarning (line 668)

Set the multipart MIME warning message (only seen by old clients)

  • access: public
void setMimeWarning (string $text)
  • string $text: The message to show
setPriority (line 492)

Set the message priority

This is an integer between 1 (high) and 5 (low)

  • access: public
void setPriority (int $priority)
  • int $priority: The level of priority to use
setReplyTo (line 512)

Set the reply-to header

  • access: public
void setReplyTo (mixed $address)
  • mixed $address: The address replies come to. String, or Swift_Address, or an array of either.
setReturnPath (line 475)

Set the return path address (where bounces go to)

  • access: public
void setReturnPath (mixed $address)
  • mixed $address: The address as a string or Swift_Address
stringToAddress (line 433)

Turn a string representation of an email address into a Swift_Address object

  • access: public
Swift_Address stringToAddress ( $string)
  • $string
useAutoLineResizing (line 183)

Enable line resizing (on 1000 by default)

  • access: public
void useAutoLineResizing ([int $size = 1000])
  • int $size: The number of characters allowed on a line
useExactCopy (line 209)

This method should be called if you do not wish to send messages in batch mode (i.e. if all recipients should see each others' addresses)

  • access: public
void useExactCopy ([boolean $bool = true])
  • boolean $bool: If this mode should be used
useLogging (line 173)

Turn logging on or off (saves memory)

  • access: public
void useLogging ([boolean $use = true])
  • boolean $use

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