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

Located in /EasySwift.php (line 30)


	
			
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 ()
Swift_Events_Listener getPlugin (string $name)
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])
Methods
Constructor __construct (line 104)

Constructor

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 733)

Add a new attachment to the message

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 578)

Add Bcc: recipients to the email

boolean addBcc (mixed $address)
  • mixed $address: Bcc address(es)
addCc (line 553)

Add Cc: recipients to the email

boolean addCc (mixed $address)
  • mixed $address: Cc address(es)
addHeaders (line 853)

Add headers to the message

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

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

Returns FALSE on failure

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

Add a new MIME part to the message

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 604)

Add recipients to the email

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

Add To: recipients to the email

boolean addTo (mixed $address)
  • mixed $address: To address(es)
authenticate (line 409)

Authenticate with SMTP authentication

  • 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 154)

Turn automatic flsuhing on or off.

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

void autoFlush ([boolean $flush = true])
  • boolean $flush
close (line 317)

Close the connection to the MTA

boolean close ()
command (line 335)

Send a command to Swift and get a response

string command (string $command)
  • string $command: The command to send (leave of CRLF)
connect (line 292)

Connect to the MTA if not already connected

void connect ()
dumpLog (line 196)

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.

void dumpLog ()
embedFile (line 810)

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

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 645)

Flush message, recipients and headers

void flush ()
flushAttachments (line 241)

Clear out all attachments

boolean flushAttachments ()
flushBcc (line 594)

Clear out all Bcc: recipients

void flushBcc ()
flushCc (line 569)

Clear out all Cc: recipients

void flushCc ()
flushErrors (line 144)

Clear the current list of errors

void flushErrors ()
flushHeaders (line 260)

Clear out all message headers

  • deprecated:
void flushHeaders ()
flushParts (line 222)

Clear out all message parts

boolean flushParts ()
flushTo (line 544)

Clear out all To: recipients

void flushTo ()
getBccAddresses (line 587)

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

array getBccAddresses ()
getCcAddresses (line 562)

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

array getCcAddresses ()
getCharset (line 693)

Get the charset of the charset to use in the message

string getCharset ()
getErrors (line 129)

Get the full list of errors

array getErrors ()
getFailedRecipients (line 654)

Get a list of any addresses which have failed since instantiation

array getFailedRecipients ()
getLastError (line 137)

Get the last error that occured

string getLastError ()
getMimeWarning (line 670)

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

string getMimeWarning ()
getPlugin (line 365)

Get a reference to the plugin identified by $name

Swift_Events_Listener getPlugin (string $name)
  • string $name: the ID of the plugin
getReplyTo (line 515)

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

array getReplyTo ()
getReturnPath (line 495)

Get the return-path address as a string

string getReturnPath ()
getToAddresses (line 537)

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

array getToAddresses ()
getTransactions (line 187)

Dump the log contents

  • deprecated:
void getTransactions ()
handshake (line 309)

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

void handshake ()
hasFailed (line 277)

Check if Swift has failed or not

This facade stops processing if so

boolean hasFailed ()
isConnected (line 285)

Check if the current connection is open or not

boolean isConnected ()
loadAuthenticator (line 394)

Load in a new authentication mechanism for SMTP

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

  • throws: Exception If the wrong connection is used
void loadAuthenticator ( $auth)
  • Swift_Authenticator $auth: The authentication mechanism to load
loadPlugin (line 353)

Add a new plugin to respond to events

  • return: The ID of the plugin
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 211)

Reset the current message and start a fresh one

void newMessage ([ $msg = false])
  • $msg
newRecipientList (line 267)

Reset the current list of recipients and start a new one

void newRecipientList ([ $list = false])
  • $list
removePlugin (line 379)

Remove the plugin identified by $name

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

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

void requestReadReceipt ([boolean $request = true])
  • boolean $request
send (line 915)

Send an email to a number of recipients

Returns the number of successful recipients, or FALSE on failure

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 679)

Set the charset of the charset to use in the message

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

Set an error message

void setError (string $msg)
  • string $msg: Error message
setHeader (line 890)

Set a header in the message

  • 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 901)

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")

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 455)

Set the encoding used in the message header

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

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

Set the maximum size of the log

void setMaxLogSize (int $size)
  • int $size
setMimeWarning (line 662)

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

void setMimeWarning (string $text)
  • string $text: The message to show
setPriority (line 487)

Set the message priority

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

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

Set the reply-to header

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

Set the return path address (where bounces go to)

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

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

Swift_Address stringToAddress ( $string)
  • $string
useAutoLineResizing (line 179)

Enable line resizing (on 1000 by default)

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

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)

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

Turn logging on or off (saves memory)

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

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