Skip to content
This repository has been archived by the owner on Nov 9, 2017. It is now read-only.

Classes \Postman\Emails\View

joebeeson edited this page Apr 4, 2011 · 1 revision

The \Postman\Library\Email\View object is intended to mimic CakePHP's own EmailComponent by utilizing the View object for rendering both the HTML and text body for the email.

One notable difference between the EmailComponent is that this object will attempt to render both HTML and text depending on what the Transport object that consumes it requests.

Methods

setTemplate($template = 'default')

This method sets the template to use when rendering.

setLayout($layout = 'default')

This method sets the layout to use when rendering.

setView($view = 'View')

This method sets the object to use when rendering.

set($key, $value = '')

Similar to how one sets values in a controller, this sets values that will be used when rendering a view.

If the $key parameter is an array all values will be added.

Notes

Other versions of the Email object expose a __call method which grants read access to their member variables. This is commonly used by Transport objects to inspect certain attributes of the Email. To accommodate for the automatic rendering, this class overrides getHtmlBody and getTextBody. Calls to these methods may be more computationally expensive since a View object must be created each time.

Related