Email Message

Class Methods

The following methods can be invoked on instances of this class.

__construct()

Constructor

setTo(string strTo)

Sets the email address to send the message to
$strTo can contain multiple to addresses: eg a@b.com, b@c.com; d@e.com Internally, this will be parsed and stored as an array

setCc(string strCc)

Sets the email address to cc the message to
$strCc can contain multiple to addresses: eg a@b.com, b@c.com; d@e.com Internally, this will be parsed and stored as an array

setToStrict(string strTo)

Sets the to address without parsing for recipients
This method is faster than setTo

getTo()

Returns the current email address to send the message to

getCc()

Returns the current email address being cc'ed to

setFrom(string strFrom)

Sets the email address of the sender

getFrom()

Returns the current email address of the sender

setFromName(string strFromName)

Sets the name of the sender

getFromName()

Returns the current name of the sender

setReplyTo(string strReplyTo)

Sets the reply address

getReplyTo()

Returns the current reply address

setReplyToName(mixed strReplyToName)

Sets the reply name

getReplyToName()

Returns the current reply name

setBounceAddress(string strBounceAddress)

Sets the return path

getBounceAddress()

Returns the current return path

setBounceTrackId(string strBounceTrackId)

Sets a bounce tracking id

getBounceTrackId()

Returns the current bounce tracking id

setSubject(mixed strSubject, bool bParse)

Sets the subject of the message

getSubject()

Returns the current subject of the message

setMessageId(string strMessageId)

Sets the Message-ID: header

getMessageId()

Returns the current Message-ID header. Will auto-generate if not set

addAdditionalHeader(mixed strHeaderName, mixed strValue)

Adds an additional header to be added

setDesignId(int iDesignId)

Sets the design which this email will be themed with

getDesignId()

Returns the design id

setContentPlain(mixed strContentPlain, bool bParse)

Sets the plain text version of the email
Note: This can be generated automatically when the HTML email is set

getContentPlain()

Returns the plain text version of the email

setContentHTML(mixed strContentHTML, bool bParse)

Sets the html version of the email

setContentHTMLBody(string strContentHTML)

Sets the html version of the email, wrapping it in <html><body> and </body></html> tags
The wrapping HTML also sets the base font style to arial

setContentHTMLBodyFromPage(string strPage)

Sets the html version of the email from a page

getContentHTML()

Returns the HTML version of the email

setEmbedImages(bool bEmbedImages)

Sets whether to embed local images in the email, rather than remotely linking them

getEmbedImages()

Returns whether or not local images will be embedded

addAttachmentFromFile(string strFileName)

Adds an attachment from a file name on disk

addAttachment(mixed strFileName, mixed strData, string strType)

Adds an attachment

setPriority(int iPriority)

Sets the priority of this email on a scale of 1 to 5
1 High 3 Normal 5 Low

getPriority()

Returns the current priority

setDateRFC822(string strDateRFC822)

Sets the message date

getDateRFC822()

Returns the message date

setCharset(string strCharset)

Sets the character set

getCharset()

Returns the current character set

setFromServer(string strFromServer)

Sets the server name used when generating a message id
Advanced users only

getFromServer()

Returns the current server name

setReadTrackURL(string strReadTrackURL)

Sets a link for read tracking

getReadTrackURL()

Returns the current link for read tracking

setLinkTrackHandler(array arrLinkTrackHandler)

Sets a handler (call_user_func_array parameter) for rewriting links

getLinkTrackHandler()

Returns the current handler for rewriting links

setLinkTrackReset(array arrLinkTrackReset)

Sets a handler (call_user_func_array parameter) for resetting after all links have
been handled

getLinkTrackReset()

Returns the current reset handler

setRelativePathRewriteBase(string strRelativePathRewriteBase)

When set, relative (/ prefixed) links will be rewritten to have the following base
path

getRelativePathRewriteBase()

Returns the current rewrite base

setSendSynchronous(bool bSendSynchronous)

Sets whether to send the mail synchronously
By default, mail will be sent in the background/asynchronously for responsiveness

getSendSynchronous()

Returns whether the mail is currently set to send synchronously

header(mixed strKey, string strValue)

Returns a header string

headerValueEncode(mixed str)

generateHeaders(mixed bIncludeTo, mixed bIncludeSubject)

boundaryBegin(mixed strId, mixed strContentType)

boundaryMarker(mixed strId)

boundaryEnd(mixed strId)

callbackLinkHTML(mixed arrMatches)

callbackLinkPlainTextHttp(mixed arrMatches)

callbackLinkPlainTextWww(mixed arrMatches)

rewriteEmbeddedCallback(mixed arrMatches)

rewriteEmbeddedInlineCallback(array arrMatches)

For embedded images using <img src="data:xxx" />

generateBodyHTML(mixed bTracking)

generateBodyPlainText(mixed bTracking)

generateBody()

send()

Sends the email

sendOne(string strTo)

Helper method to send to one address

__toString()

writeToFile(mixed strFileName)

__call(mixed strName, array arrArguments)

Magic function to trap calls to undefined functions and throw an exception rather than
a fatal error.

__callStatic(mixed strName, array arrArguments)

Magic function to trap static calls to undefined functions and throw an exception rather
than a fatal error.

classGetFolder()

Returns the folder where the class exists

__set_state(mixed arrValues)

classGetFolderResources()

Returns the folder where the class's resources exist

classGetSrcFile()

Returns the folder where the class exists

classGetSrcHash()

Returns the folder where the class exists

classGetReflection()

Returns the reflection data for the current class

classGetReflectionAnnotation(string strField)

Returns a specific class annotation for the current class