コード例 #1
0
 /**
  * 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);
     }
 }
コード例 #2
0
ファイル: Mail.php プロジェクト: SandeepUmredkar/PortalSMIP
 public function init()
 {
     $result = parent::init();
     //Set dependecies.
     $this->getBootstrap()->bootstrap('view');
     App_Mail::setDefaultOptions($this->getOptions());
     return $result;
 }
コード例 #3
0
    // 	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);
// }
コード例 #4
0
ファイル: Mail.php プロジェクト: SandeepUmredkar/PortalSMIP
 /**
  *
  * Default options setter.
  * @param array $options
  */
 public static function setDefaultOptions($options = array())
 {
     if (is_array($options)) {
         self::$_defaultOptions = $options;
     }
 }
コード例 #5
0
 protected function _createMail(UserModel $user, $brand = null)
 {
     if (\App::get('mail') === null) {
         throw new UnexpectedException('No mail transport configured');
     }
     $fullName = $user->getFirstName() . ' ' . $user->getLastName();
     // Creating / configuring email object.
     $mail = new \App_Mail('UTF-8');
     $mail->setLocale($user->getLanguage());
     $mail->addTo($user->getEmail(), $fullName);
     $view = $mail->getView();
     $view->fullName = $fullName;
     $view->userName = $user->userName;
     $view->user = $user;
     // Configure brand mail folder
     if (!$brand || !$brand instanceof BrandModel) {
         $brandService = BrandService::getInstance();
         $brand = $brandService->loadByUser($user);
     }
     if (!$brand || !$brand instanceof BrandModel) {
         throw new NotFoundException("Brand not found for user " . $user->id);
     }
     $mail->setScriptNamespace($brand->getScriptNamespace());
     $view->setBaseUrl($brand->getEndPoint());
     $view->setImageNamespace($brand->getImageNamespace());
     $view->brand = $brand;
     \App::log()->debug("Sending an email using '" . $brand->brand . "' brand");
     return $mail;
 }