/** * Loads a list of Email_Log for the specified parameters, returns an array of Email_Log elements * * @return array */ public function load() { $emailLogs = $this->db->fetchCol("SELECT id FROM email_log" . $this->getCondition() . $this->getOrder() . $this->getOffsetLimit(), $this->model->getConditionVariables()); $emailLogsArray = array(); foreach ($emailLogs as $log) { $emailLogsArray[] = Model\Tool\Email\Log::getById($log); } $this->model->setEmailLogs($emailLogsArray); return $emailLogsArray; }
/** * Resends the email to the recipients */ public function resendEmailAction() { if (!$this->getUser()->isAllowed("emails")) { throw new \Exception("Permission denied, user needs 'emails' permission."); } $success = false; $emailLog = Tool\Email\Log::getById($this->getParam('id')); if ($emailLog instanceof Tool\Email\Log) { $mail = new Mail(); $mail->preventDebugInformationAppending(); if ($html = $emailLog->getHtmlLog()) { $mail->setBodyHtml($html); } if ($text = $emailLog->getTextLog()) { $mail->setBodyText($text); } $mail->setFrom($emailLog->getFrom()); foreach ($emailLog->getToAsArray() as $entry) { $mail->addTo($entry['email'], $entry['name']); } foreach ($emailLog->getCcAsArray() as $entry) { $mail->addCc($entry['email'], $entry['name']); } foreach ($emailLog->getBccAsArray() as $entry) { $mail->addBcc($entry['email']); } $mail->setSubject($emailLog->getSubject()); $mail->send(); $success = true; } $this->_helper->json(array("success" => $success)); }