_mail = $mail; $this->_layout = $layout; } public function _write($event) { $this->_events[] = $event; } public function shutdown() { // Check for events if (!empty($this->_events)) { // Apply formatter if set, typically should not if (isset($this->_formatter)) { foreach ($this->_events as & $event) { $event = $this->_formatter->format($event); } } // Use layout if set // Else send list of events if (isset($this->_layout)) { $this->_layout->events = $this->_events; $body = $this->_layout->render(); } else { $body = implode("
\r\n", $this->_events); } // Set mail to alterative miltipart $this->_mail->setType(Zend_Mime::MULTIPART_ALTERNATIVE); // Add body to mail $this->_mail->setBodyHtml($this->_mail->getBodyHtml(true) . $body); $this->_mail->setBodyText($this->_mail->getBodyText(true) . strip_tags($body)); // Send e-mail $this->_mail->send(); } } } ?>