/** * Closed at production environment, available at development */ public function emailAction() { $this->_develOnly(); $data = $this->_helper->requestData(); $mail = new App_Mail(); $mail->setViewScript('welcome'); $mail->addTo($data['mail'], $data['name']); try { $mail->send(); } catch (Exception $e) { App::log($e, Zend_Log::CRIT); } }
// echo "<p>Skipped Mailing: {$co['email']}</p>\n"; // } $sum += $bal; } echo "<p style='font-weight:700;'>Total Balance: {$sum}</p>\n"; // Send me the Summary $body = ob_get_clean(); $mail = <<<EOF Content-Transfer-Encoding: 8bit Content-Type: text/html; charset="utf-8" From: %head_from% MIME-Version: 1.0 Message-Id: <%head_hash%> Subject: %head_subj% X-MailGenerator: Edoceo Imperium v2013.43 {$body} EOF; // Clean $mail = str_replace('%head_from%', sprintf('"%s" <%s>', $_ENV['company']['name'], $_ENV['mail']['from']), $mail); $mail = str_replace('%head_hash%', md5(openssl_random_pseudo_bytes(256)) . '@' . parse_url($_ENV['application']['base'], PHP_URL_HOST), $mail); $mail = str_replace('%head_subj%', '[Imperium] Past Due Invoices Summary', $mail); $mail = str_replace('%mail_rcpt%', $_ENV['cron']['alert_to'], $mail); if (!empty($cli_opt['cron'])) { App_Mail::send($_ENV['cron']['alert_to'], $mail); } // if ( !empty($cli_opt['mail']) && !empty($_ENV['cron']['alert_to']) ) { // // } else { // echo strip_tags($body); // }