Key
This line was removed.
This word was removed. This word was added.
This line was added.

Changes (2)

View Page History
{code}
{card}
{card:label=UC-03: Zend_Commons_Email}
{code}
// Sending of an email created by a template, where every
// email template looks similar to a PHTML view:
Zend_Commons::factory('email')
->setTemplate('welcome.email')
->inMail('setSubject', $name . ', your account is ready!')
->setParam('title', 'Mr.')
->setParam('name', 'John Doe')
->inMail('addAttachment', new Zend_Mime_Part(...))
->execute(); // send email

// Preliminary we can configure this strategy factory by
// means of static methods of Zend_Commons_Email, for example:
Zend_Commons_Email::setDefaultView(new Zend_View());
Zend_Commons_Email::setDefaultTransport(new Zend_Mail_Transport_Smtp(...));
Zend_Commons_Email::setDefaultFolder(APPLICATION_PATH . '/emails');
Zend_Commons_Email::setDefaultLocale(new Zend_Locale('fr'));

// All these static parameters can be re-configured in
// every particular strategy object, for example:
Zend_Commons::factory('email')
->setTemplate('welcome.email')
->setParam('name', 'John Doe')
->setLocale(new Zend_Locale('de'))
->setFolder(APPLICATION_PATH . '/new-emails')
->setTransport(new Zend_Mail_Transport_Sendmail(...))
->execute();
{code}
{card}
{card:label=UC-04: Custom plugins}
{code}
{code}
{card}
{card:label=Zend_Commons_Exec}
{code}
/**
* Send email.
*/
class Zend_Commons_Email extends Zend_Commons_Abstract
{
/**
* Set default locale.
* @param Zend_Locale The locale
*/
public static function setDefaultLocale(Zend_Locale $locale);

/**
* Set default location of email templates.
* @param string The directory
*/
public static function setDefaultFolder($folder);

/**
* Set default mail transport.
* @param Zend_Mail_Transport_Abstract The transport to use
*/
public static function setDefaultTransport(Zend_Mail_Transport_Abstract $transport);

/**
* Set default view to use for rendering.
* @param Zend_View The view
*/
public static function setDefaultView(Zend_View $view);

/**
* Set instance-specific locale.
* @param Zend_Locale The locale
* @return $this
*/
public function setLocale(Zend_Locale $locale);

/**
* Set instance-specific location of email templates.
* @param string The directory
* @return $this
*/
public function setFolder($folder);

/**
* Set instance-specific mail transport.
* @param Zend_Mail_Transport_Abstract The transport to use
* @return $this
*/
public function setTransport(Zend_Mail_Transport_Abstract $transport);

/**
* Set instance-specific view to use for rendering.
* @param Zend_View The view
* @return $this
*/
public function setView(Zend_View $view);

/**
* Set certain parameter available in view/template.
* @param string The name of the parameter
* @param mixed The value
* @return $this
*/
public function setParam($name, $value);

/**
* Call method of the underlying Zend_Mail object.
* @param string The method
* @return $this
*/
public function inMail($method /* arguments */);

/**
* Execute the command, send the email.
* @return mixed
*/
public function execute();
}
{code}
{card}
{deck}
{zone-data}