Properties

$renderer

$renderer : \Zend\View\Renderer\PhpRenderer

The PhpRender used to render view script

Type

\Zend\View\Renderer\PhpRenderer

$transport

$transport : \AclUser\Mail\Zend\Mail\Transport\TransportInterface

Transport used to send message

Type

\AclUser\Mail\Zend\Mail\Transport\TransportInterface

$viewScript

$viewScript : string

The view script used for the e-mail message

Type

string

$totalImages

$totalImages : integer

Keep track of the number of inline images so that the correct mime type can be assigned

Type

integer — the number of inline images

$layoutTemplate

$layoutTemplate : string

The layout script used for this e-mail message

Type

string — default layout template

$viewParams

$viewParams : array

An array of key - value pairs to be inserted into the view script

Type

array

$inlineImages

$inlineImages : array

Array of inline images with image type and file location to be added the the e-mail view

Type

array

$layoutImages

$layoutImages : array

Array of inline images with image type and file location to be added the the e-mail layout

Type

array

$attachments

$attachments : array

Array of attachments to be added to the message Tested with png, jpg, pdf and zip files

Type

array

$embedImageFromSrc

$embedImageFromSrc : boolean

Whether images should be embedded in the e-mail based on the IMG tag SRC attribute IMG tag needs to have the class embed-image for this to take effect

Type

boolean

$index

$index : integer

integer to avoid errors in CID value

Type

integer

Methods

__construct()

__construct(\Zend\View\Renderer\PhpRenderer  $renderer) 

Constructor (requires ZF phprenderer)

Parameters

\Zend\View\Renderer\PhpRenderer $renderer

used to render view script

setSmtpTransport()

setSmtpTransport(\AclUser\Mail\Zend\Mail\Transport\Smtp  $transport) 

Set transport using SMTP protocol

Parameters

\AclUser\Mail\Zend\Mail\Transport\Smtp $transport

transport used to send e-mail

setViewScript()

setViewScript(string  $viewScript) : $this

Set the view script that should be used for this e-mail message

Parameters

string $viewScript

pointer to location of view script

Returns

$this —

AclUser\Mail\MailMessage

setLayoutTemplate()

setLayoutTemplate(string  $layoutTemplate) : $this

Over ride default e-mail layout

{@source}

Parameters

string $layoutTemplate

Returns

$this —

AclUser\Mail\MailMessage

setViewParams()

setViewParams(array  $viewParams) : $this

Set view params to be used within the e-mail message view script

Parameters

array $viewParams

key value pairs to be passed to view script

Returns

$this —

AclUser\Mail\MailMessage {@source}

setInlineImages()

setInlineImages(array  $inlineImages) : $this

Set inline attachments (of view script) to send with message the key of each array must correspond to parameter passed to the view script each item in array must contain array with keys type and filepath that corresponds to parameters of Zend\Mime\Part parameters of same name

Parameters

array $inlineImages

array in format given above

Throws

\Exception

if

Returns

$this —

AclUser\Mail\MailMessage

setLayoutImages()

setLayoutImages(array  $layoutImages) : $this

Specify inline images to be added to layout script the key of each array must correspond to the parameter passed to e-mail layout each item in array must contain array with keys: type and filepath that corresponds to Zend\Mime\Part parameters of same name.

Exception will be thrown if array's requirements are not met

Parameters

array $layoutImages

array in format given above

Throws

\Exception

Returns

$this —

AclUser\Mail\MailMessage

setAttachments()

setAttachments(array  $attachments) : $this

Set (non inline) attachments to send with message each item in array must contain array with keys type and filepath that corresponds to parameters of Zend\Mime\Part parameters of same name TYPES: PDF - application/pdf ZIP - application/octet-stream PNG - image/png JPG - image/jpg

Parameters

array $attachments

array of attachments

Throws

\Exception

Returns

$this —

AclUser\Mail\MailMessage

embedImageFromSrc()

embedImageFromSrc(boolean  $embedImageFromSrc = true) : $this

Tell system whether to embed images based on IMG tag SRC attribute note that the IMG tag must have a class of ember-image as well

Parameters

boolean $embedImageFromSrc

whether to search image src and embed images where possible

Returns

$this —

AclUser\Mail\MailMessage

sendEmailBasedOnViewScript()

sendEmailBasedOnViewScript() 

Send the e-mail message based on the view script

validateAttachmentFormat()

validateAttachmentFormat(array  $attachments) : boolean

Check whether images array passed to set methods has the correct format

Parameters

array $attachments

Returns

boolean

getTransport()

getTransport() : \AclUser\Mail\Zend\Mail\Transport\TransportInterface

Get the transport to be used to send the message

Returns

\AclUser\Mail\Zend\Mail\Transport\TransportInterface

addInlinePartsToMimeMessage()

addInlinePartsToMimeMessage(\AclUser\Mail\Zend\Mime\Message  $mimeMessage) : \AclUser\Mail\Zend\Mime\Message

Add all inline elements to the e-mail message

Parameters

\AclUser\Mail\Zend\Mime\Message $mimeMessage

Returns

\AclUser\Mail\Zend\Mime\Message

addLayoutImages()

addLayoutImages(\AclUser\Mail\Zend\Mime\Message  $mimeMessage, \Zend\View\Model\ViewModel  $viewLayout) 

Actually add the inline images to the layout of the e-mail message

Parameters

\AclUser\Mail\Zend\Mime\Message $mimeMessage
\Zend\View\Model\ViewModel $viewLayout

addInlineImages()

addInlineImages(\AclUser\Mail\Zend\Mime\Message  $mimeMessage, \Zend\View\Model\ViewModel  $view) 

Actually add the inline images to the view of the e-mail message

Parameters

\AclUser\Mail\Zend\Mime\Message $mimeMessage
\Zend\View\Model\ViewModel $view

addAttachments()

addAttachments(\AclUser\Mail\Zend\Mime\Message  $mimeMessage) 

Actually add the attachments of the e-mail message

Parameters

\AclUser\Mail\Zend\Mime\Message $mimeMessage

getImagesToEmbedFromSrc()

getImagesToEmbedFromSrc(string  $rendered, \Zend\Mime\Message  $mimeMessage) : string

Search through IMG tags and embed them if embedImageFromSrc evaluates to true and the IMG tag has the embed-image class

Parameters

string $rendered
\Zend\Mime\Message $mimeMessage

Returns

string

completeEmbedImagesFromSrc()

completeEmbedImagesFromSrc(array  $chosenImagesNodes, \AclUser\Mail\Zend\Dom\NodeList  $imageNodeList, \Zend\Mime\Message  $mimeMessage) : string

Actually embed inline images based on their source

Parameters

array $chosenImagesNodes

image nodes in document that need to have their src attribute substituted

\AclUser\Mail\Zend\Dom\NodeList $imageNodeList

(all) image nodes in document

\Zend\Mime\Message $mimeMessage

Returns

string —

the html e-mail string

tryToGetImageFromSrc()

tryToGetImageFromSrc(string  $src) : boolean|\AclUser\Mail\image

Try to get image from file system based on IMG SRC attribute Temporarily turn off warning reporting so that nothing appears in browser when the image is not found.

Parameters

string $src

Returns

boolean|\AclUser\Mail\image —

file contents

createMimePart()

createMimePart(string  $content, string  $filename, string  $type, string  $disposition) : \Zend\Mime\Part

Create individual mime part to be attached o the message

Parameters

string $content

the data of the file

string $filename

the name of the file

string $type

the mime type of the file

string $disposition

disposition for (part) of header Content-Disposition

Returns

\Zend\Mime\Part