当前位置: 首页>>代码示例>>PHP>>正文


PHP Mailer::getTemplate方法代码示例

本文整理汇总了PHP中Mailer::getTemplate方法的典型用法代码示例。如果您正苦于以下问题:PHP Mailer::getTemplate方法的具体用法?PHP Mailer::getTemplate怎么用?PHP Mailer::getTemplate使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Mailer的用法示例。


在下文中一共展示了Mailer::getTemplate方法的10个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: processRegisterAction

 /**
  * Process Register action
  */
 public function processRegisterAction()
 {
     $db = $this->db;
     $form = new Owner_Registration();
     if ($this->_request->isXmlHttpRequest() && $form->isValid($_POST)) {
         $data = $form->getValidValues($_POST);
         //mark as free trial
         $data["free_trial"] = 1;
         $newRecord = $this->ownerModel->create($data);
         //query newly create record
         $owner = $this->ownerModel->find($newRecord)->toArray();
         try {
             //sends an email
             $mail = new Zend_Mail("utf-8");
             $mail->addTo($owner["email"], $owner["first_name"] . " " . $owner["last_name"]);
             $mail->setBodyHtml(Mailer::getTemplate("welcome.phtml", array("fullname" => $owner["first_name"] . " " . $owner["last_name"])));
             $mail->setSubject("welcome to Leadschat");
             $mail->setFrom("noreply@leadschat.com");
             $mail->send(Mailer::getTransport());
         } catch (Exception $e) {
         }
         $this->view->result = array("result" => true);
     } else {
         $this->view->result = array("result" => false, "errors" => $form->getErrors());
     }
     $this->_helper->layout->setLayout("plain");
     $this->_helper->viewRenderer("json");
 }
开发者ID:redhattaccoss,项目名称:Leadschat,代码行数:31,代码来源:OwnersController.php

示例2: index

 public function index()
 {
     if ($this->user->isLogged()) {
         $this->redirect($this->url->link('common/home', '', 'SSL'));
     }
     if (!$this->config->get('admin_reset_password')) {
         $this->redirect($this->url->link('common/login', '', 'SSL'));
     }
     $this->document->setTitle(Language::getVar('SUMO_NOUN_FORGOT_PASSWORD'));
     $this->load->model('user/user');
     if ($this->request->server['REQUEST_METHOD'] == 'POST' && $this->validate()) {
         $code = sha1(uniqid(mt_rand(), true) . $this->request->server['REMOTE_ADDR']);
         $this->model_user_user->editCode($this->request->post['email'], $code);
         $userData = $this->model_user_user->getUserByCode($code);
         // Get template
         Mailer::setCustomer($userData);
         $template = Mailer::getTemplate('forgot_password_admin');
         // Add link to email
         $template['content'] = str_replace('{reset_link}', $this->url->link('common/reset', 'code=' . $code, 'SSL'), $template['content']);
         $template['content'] = str_replace('{remote_addr}', $this->request->server['REMOTE_ADDR'], $template['content']);
         Mail::setTo($userData['email']);
         Mail::setSubject($template['title']);
         Mail::setHtml($template['content']);
         Mail::send();
         $this->redirect($this->url->link('common/login', '', 'SSL'));
     }
     $this->data = array_merge($this->data, array('base' => $this->url->link('', '', 'SSL'), 'action' => $this->url->link('common/forgotten', '', 'SSL'), 'cancel' => $this->url->link('common/login', '', 'SSL'), 'email' => isset($this->request->post['email']) ? $this->request->post['email'] : '', 'error_warning' => isset($this->error['warning']) ? $this->error['warning'] : ''));
     $this->data['settings'] = $this->config->get('details_account_' . $this->config->get('template'));
     if (!is_array($this->data['settings']) || !count($this->data['settings'])) {
         $this->data['settings']['left'][] = $this->getChild('app/widgetsimplesidebar/', array('type' => 'accountTree', 'data' => array()));
     }
     $this->template = 'common/forgotten.tpl';
     $this->children = array('common/header', 'common/footer');
     $this->response->setOutput($this->render());
 }
开发者ID:wardvanderput,项目名称:SumoStore,代码行数:35,代码来源:forgotten.php

示例3: send

 public function send()
 {
     $this->load->model('sale/invoice');
     $invoiceData = $this->model_sale_invoice->getInvoice($this->request->get['invoice_id']);
     $this->load->model('sale/customer');
     $customerData = $this->model_sale_customer->getCustomer($invoiceData['customer_id']);
     // Save invoice in cache
     $pdf = $this->download(true);
     $handle = fopen(DIR_CACHE . $invoiceData['invoice_no'] . '.pdf', 'w+');
     fwrite($handle, $pdf);
     fclose($handle);
     // Get template
     Mailer::setInvoice($invoiceData);
     Mailer::setCustomer($customerData);
     $template = Mailer::getTemplate('send_invoice');
     Mail::setTo($invoiceData['customer_email']);
     Mail::setSubject($template['title']);
     Mail::setHtml($template['content']);
     Mail::addAttachment(DIR_CACHE . $invoiceData['invoice_no'] . '.pdf');
     Mail::send();
     // Mark invoice as sent
     $this->model_sale_invoice->markSent($invoiceData['invoice_id']);
     // Change status (if necessary)
     if ($invoiceData['status'] == 'CONCEPT') {
         $this->model_sale_invoice->changeStatus($invoiceData['invoice_id'], 'sent');
     }
     // Remove invoice
     @unlink(DIR_CACHE . $invoiceData['invoice_no'] . '.pdf');
     $this->redirect($this->url->link('sale/invoice', 'token=' . $this->session->data['token'], 'SSL'));
 }
开发者ID:wardvanderput,项目名称:SumoStore,代码行数:30,代码来源:invoice.php

示例4: addCustomer

 public function addCustomer($data)
 {
     $this->load->model('account/customer_group');
     if (empty($data['customer_group_id'])) {
         $data['customer_group_id'] = $this->config->get('customer_group_id');
     }
     $group_info = $this->model_account_customer_group->getCustomerGroup($data['customer_group_id']);
     $salt = substr(md5(uniqid(rand(), true) . $this->request->server['REMOTE_ADDR']), 0, 9);
     $data['birthdate'] = date('Y-m-d', strtotime($data['birthdate']));
     $this->query("INSERT INTO PREFIX_customer\n            SET store_id            = :store_id,\n                firstname           = :firstname,\n                middlename          = :middlename,\n                lastname            = :lastname,\n                birthdate           = :birthdate,\n                email               = :email,\n                telephone           = :telephone,\n                mobile              = :mobile,\n                gender              = :gender,\n                fax                 = :fax,\n                salt                = :salt,\n                password            = :password,\n                newsletter          = :newsletter,\n                customer_group_id   = :group_id,\n                language_id         = :language_id,\n                ip                  = :ip,\n                status              = 1,\n                approved            = :approval,\n                date_added          = :date", array('store_id' => $this->config->get('store_id'), 'firstname' => $data['firstname'], 'middlename' => $data['middlename'], 'lastname' => $data['lastname'], 'birthdate' => $data['birthdate'], 'email' => $data['email'], 'telephone' => $data['telephone'], 'mobile' => $data['mobile'], 'gender' => $data['gender'], 'fax' => $data['fax'], 'salt' => $salt, 'password' => sha1($salt . sha1($salt . sha1($data['password']))), 'newsletter' => $data['newsletter'], 'ip' => $this->request->server['REMOTE_ADDR'], 'group_id' => $data['customer_group_id'], 'language_id' => $this->config->get('language_id'), 'approval' => !$group_info['approval'], 'date' => date('Y-m-d H:i:s')));
     $customer_id = $this->lastInsertId();
     if (!$customer_id) {
         Logger::error('[ACCOUNT/CUSTOMER] The customer could not be created');
         Logger::error(print_r(self::$connection->errorInfo(), true));
         return false;
     }
     $this->query("INSERT INTO PREFIX_address\n            SET customer_id         = :id,\n                firstname           = :firstname,\n                middlename          = :middlename,\n                lastname            = :lastname,\n                company             = :company,\n                company_id          = :cid,\n                tax_id              = :tax,\n                address_1           = :address_1,\n                number              = :number,\n                addon               = :addon,\n                address_2           = :address_2,\n                postcode            = :postcode,\n                city                = :city,\n                country_id          = :country_id,\n                zone_id             = :zone_id", array('id' => $customer_id, 'firstname' => $data['firstname'], 'middlename' => $data['middlename'], 'lastname' => $data['lastname'], 'company' => $data['company'], 'cid' => $data['company_id'], 'tax' => $data['tax_id'], 'address_1' => $data['address_1'], 'number' => $data['number'], 'addon' => $data['addon'], 'address_2' => $data['address_2'], 'postcode' => $data['postcode'], 'city' => $data['city'], 'country_id' => $data['country_id'], 'zone_id' => $data['zone_id']));
     $address_id = $this->lastInsertId();
     $this->query("UPDATE PREFIX_customer SET address_id = :aid WHERE customer_id = :cid", array('aid' => $address_id, 'cid' => $customer_id));
     if ($group_info['approval']) {
         $message = Language::getVar('SUMO_ACCOUNT_WAIT_FOR_APPROVAL');
     } else {
         $message = Language::getVar('SUMO_ACCOUNT_GO_TO_LOGIN', $this->url->link('account/login', '', 'SSL'));
     }
     Mailer::setCustomer($data);
     $template = Mailer::getTemplate('account_register');
     $template['content'] = str_replace('{approvalOrLogin}', $message, $template['content']);
     Mail::setTo($data['email']);
     Mail::setSubject($template['title']);
     Mail::setHtml($template['content']);
     Mail::send();
     if ($this->config->get('admin_notify_email')) {
         $sendTo = array($this->config->get('email'));
         $extra = $this->config->get('extra_notify_email');
         if (!empty($extra)) {
             $extra = explode(',', $extra);
             foreach ($extra as $mail) {
                 if (!empty($mail) && filter_var($mail, \FILTER_VALIDATE_EMAIL)) {
                     $sendTo[] = $mail;
                 }
             }
         }
         $template = Mailer::getTemplate('account_register_admin_notify');
         if ($group_info['approval']) {
             $template['content'] = str_replace('{action}', Language::getVar('SUMO_ADMIN_ACTIVATE_ACCOUNT', $this->url->link('account/login')), $template['content']);
         } else {
             $template['content'] = str_replace('{action}', '', $template['content']);
         }
         foreach ($sendTo as $to) {
             Mail::setTo($to);
             Mail::setSubject($template['title']);
             Mail::setHtml($template['content']);
             Mail::send();
         }
     }
     Cache::removeAll();
     return $customer_id;
 }
开发者ID:wardvanderput,项目名称:SumoStore,代码行数:58,代码来源:customer.php

示例5: index

 public function index()
 {
     if ($this->customer->isLogged()) {
         $this->redirect($this->url->link('account/account', '', 'SSL'));
     }
     $this->document->setTitle(Language::getVar('SUMO_ACCOUNT_FORGOTTEN_TITLE'));
     $this->load->model('account/customer');
     if ($this->request->server['REQUEST_METHOD'] == 'POST' && $this->validate()) {
         $start = rand(0, 10);
         $end = rand(10, 14);
         $password = str_shuffle(substr(sha1(uniqid(mt_rand(), true) . $this->request->server['REMOTE_ADDR']), $start, $end));
         $this->model_account_customer->editPassword($this->request->post['email'], $password);
         $customerData = $this->model_account_customer->getCustomerByEmail($this->request->post['email']);
         // Get template
         Mailer::setCustomer($customerData);
         $template = Mailer::getTemplate('forgot_password_customer');
         // Add link to email
         $template['content'] = str_replace('{password}', $password, $template['content']);
         $template['content'] = str_replace('{remote_addr}', $this->request->server['REMOTE_ADDR'], $template['content']);
         Mail::setTo($customerData['email']);
         Mail::setSubject($template['title']);
         Mail::setHtml($template['content']);
         Mail::send();
         $this->session->data['success'] = Language::getVar('SUMO_ACCOUNT_PASSWORD_SENT');
         $this->redirect($this->url->link('account/login', '', 'SSL'));
     }
     $this->data['breadcrumbs'] = array();
     $this->data['breadcrumbs'][] = array('text' => Language::getVar('SUMO_NOUN_HOME'), 'href' => $this->url->link('common/home'), 'separator' => false);
     $this->data['breadcrumbs'][] = array('text' => Language::getVar('SUMO_ACCOUNT_TITLE'), 'href' => $this->url->link('account/account', '', 'SSL'));
     $this->data['breadcrumbs'][] = array('text' => Language::getVar('SUMO_ACCOUNT_FORGOTTEN_TITLE'), 'href' => $this->url->link('account/forgotten', '', 'SSL'));
     $this->data['warning'] = '';
     if (isset($this->error['warning'])) {
         $this->data['warning'] = $this->error['warning'];
     }
     $this->data['action'] = $this->url->link('account/forgotten', '', 'SSL');
     $this->data['settings'] = $this->config->get('details_account_' . $this->config->get('template'));
     if (!is_array($this->data['settings']) || !count($this->data['settings'])) {
         $this->data['settings']['left'][] = $this->getChild('app/widgetsimplesidebar/', array('type' => 'accountTree', 'data' => array()));
     }
     $this->template = 'account/forgotten.tpl';
     $this->children = array('common/footer', 'common/header');
     $this->response->setOutput($this->render());
 }
开发者ID:wardvanderput,项目名称:SumoStore,代码行数:43,代码来源:forgotten.php

示例6: addReturnHistory

 public function addReturnHistory($return_id, $data)
 {
     $this->query("UPDATE PREFIX_return\n            SET return_status_id    = :status_id,\n                date_modified       = :date\n            WHERE return_id         = :id", array('status_id' => $data['return_status_id'], 'date' => date('Y-m-d H:i:s'), 'id' => $return_id));
     if (!isset($data['notify'])) {
         $data['notify'] = 0;
     }
     $data['date'] = date('Y-m-d H:i:s');
     $data['return_id'] = $return_id;
     $this->query("INSERT INTO PREFIX_return_history\n            SET return_id           = :return_id,\n                return_status_id    = :return_status_id,\n                notify              = :notify,\n                comment             = :comment,\n                date_added          = :date", $data);
     if ($data['notify']) {
         $return_data = $this->getReturn($return_id);
         Mailer::setCustomer($return_data);
         Mailer::setReturn($return_data);
         $mail = Mailer::getTemplate('update_return_status_' . $data['return_status_id']);
         if (!empty($data['comment'])) {
             $mail['content'] = str_replace('{hasComments}', $data['comment'] . '<br /><br />', $mail['content']);
         } else {
             $mail['content'] = str_replace('{hasComments}', '', $mail['content']);
         }
         Mail::setTo($return_data['email']);
         Mail::setSubject($mail['title']);
         Mail::setHTML($mail['content']);
         Mail::send();
     }
     Cache::removeAll();
 }
开发者ID:wardvanderput,项目名称:SumoStore,代码行数:26,代码来源:return.php

示例7: addReward

 public function addReward($customer_id, $description = '', $points = '', $order_id = 0)
 {
     $customer_info = $this->getCustomer($customer_id);
     if ($customer_info && !empty($description)) {
         $this->query("INSERT INTO PREFIX_customer_reward SET\n                customer_id = '" . (int) $customer_id . "',\n                order_id = '" . (int) $order_id . "',\n                points = '" . (int) $points . "',\n                description = :description,\n                date_added = NOW()", array('description' => $description));
         Mailer::setCustomer($customer_info);
         $template = Mailer::getTemplate('account_reward', !empty($customer_info['language_id']) ? $customer_info['language_id'] : null);
         Mail::setTo($customer_info['email']);
         Mail::setSubject($template['subject']);
         Mail::setHtml($template['content']);
         Mail::send();
     }
     Cache::removeAll();
 }
开发者ID:wardvanderput,项目名称:SumoStore,代码行数:14,代码来源:customer.php

示例8: updateStatus

    public function updateStatus($order_id, $status_id, $extra = '', $notify = null)
    {
        if ($status_id == 1) {
            $notify = true;
        } else {
            $old = $this->get($order_id);
            if (!isset($old['status_id']) || isset($old['status_id']) && isset($data['status_id']) && $old['status_id'] != $data['status_id']) {
                //$this->updateStatus($order_id, !empty($data['status_id']) ? $data['status_id'] : 1, !empty($data['status']['comment']) ? $data['status']['comment'] : !empty($data['comment']) ? $data['comment'] : '');
                if ($notify == null) {
                    $notify = $this->config->get('customer_notify_email');
                }
            } else {
                //$this->updateStatus($order_id, 1, !empty($data['comment']) ? $data['comment'] : '');
                if ($notify == null) {
                    $notify = false;
                }
            }
        }
        $this->query("UPDATE PREFIX_orders\n            SET order_status    = :status\n            WHERE order_id      = :id", array('status' => $status_id, 'id' => $order_id));
        if ($notify || $this->config->get('admin_notify_email')) {
            $template = Mailer::getTemplate('update_order_status_' . $status_id);
            $content = $template['content'];
            if ($status_id == 1) {
                $this->load->model('account/order');
                $orderInfo = $this->model_account_order->getOrder($order_id);
                Mailer::setOrder($orderInfo);
                // Grab order totals
                foreach ($this->model_account_order->getOrderTotals($order_id) as $total) {
                    if (!empty($total['label_inject'])) {
                        $label = sprintf(Language::getVar($total['label'] . '_INJ'), $total['label_inject']);
                    } else {
                        $label = Language::getVar($total['label']);
                    }
                    $totals[] = array_merge($total, array('label' => $label));
                }
                // Grab order products
                foreach ($this->model_account_order->getOrderProducts($order_id) as $product) {
                    $price = $product['price'] * (1 + $product['tax_percentage'] / 100);
                    $products[] = array_merge($product, array('price' => Formatter::currency($price), 'total' => Formatter::currency($price * $product['quantity']), 'return' => $this->url->link('account/return/insert', 'order_id=' . $orderInfo['order_id'] . '&product_id=' . $product['product_id'], 'SSL')));
                }
                /**
                 * Parse address info
                 */
                // 1. Shipping
                $shippingAddress = str_replace('{address_1}', '{address_1} {number}{addon}', $orderInfo['customer']['shipping_address']['address_format']);
                foreach ($orderInfo['customer']['shipping_address'] as $key => $value) {
                    $shippingAddress = str_replace('{' . $key . '}', $value, $shippingAddress);
                }
                // 2. Payment
                $paymentAddress = str_replace('{address_1}', '{address_1} {number}{addon}', $orderInfo['customer']['payment_address']['address_format']);
                foreach ($orderInfo['customer']['payment_address'] as $key => $value) {
                    $paymentAddress = str_replace('{' . $key . '}', $value, $paymentAddress);
                }
                // Remove remaining vars and excessive line breaks
                $shippingAddress = preg_replace("/\\{([a-z0-9_\\-]+)\\}/", '', $shippingAddress);
                $shippingAddress = preg_replace("/[\r\n]+/", "\n", $shippingAddress);
                // Remove remaining vars and excessive line breaks
                $paymentAddress = preg_replace("/\\{([a-z0-9_\\-]+)\\}/", '', $paymentAddress);
                $paymentAddress = preg_replace("/[\r\n]+/", "\n", $paymentAddress);
                // Other data
                $order_date = Formatter::date(time());
                $order_id = str_pad($order_id, 6, 0, STR_PAD_LEFT);
                $payment_method = $orderInfo['payment']['name'];
                $shipping_method = $orderInfo['shipping']['name'];
                $order_view = '<hr />
<div class="row">
    <div class="col-sm-6">
        <h4>' . Language::getVar('SUMO_NOUN_INVOICE_ADDRESS') . '</h4>
        <p>' . nl2br($paymentAddress) . '</p>
    </div>

    <div class="col-sm-6">
        <h4>' . Language::getVar('SUMO_NOUN_SHIPPING_ADDRESS') . '</h4>
        <p>' . nl2br($shippingAddress) . '</p>
    </div>
</div>
<hr>
<div class="row">
    <div class="col-sm-6">
        <dl class="info">
            <dt>' . Language::getVar('SUMO_NOUN_ORDER_NO') . ':</dt>
            <dd>' . $order_id . '</dd>
        </dl>
    </div>
    <div class="col-sm-6">
        <dl class="info">
            <dt>' . Language::getVar('SUMO_NOUN_ORDER_DATE') . ':</dt>
            <dd>' . $order_date . '</dd>
        </dl>
    </div>
</div>
<table class="table" style="margin-top: 30px; font-size: 100%;">
    <thead>
        <tr>
            <th style="width: 65px; font-size: 14px;">' . Language::getVar('SUMO_NOUN_QUANTITY') . '</th>
            <th>' . Language::getVar('SUMO_NOUN_PRODUCT') . '</th>
            <th style="width: 75px;">' . Language::getVar('SUMO_NOUN_MODEL') . '</th>
            <th class="text-right" style="width: 75px;">' . Language::getVar('SUMO_NOUN_PRICE') . '</th>
            <th class="text-right" style="width: 75px;">' . Language::getVar('SUMO_NOUN_TOTAL') . '</th>
            <th style="width: 30px;"></th>
//.........这里部分代码省略.........
开发者ID:wardvanderput,项目名称:SumoStore,代码行数:101,代码来源:order.php

示例9: preview

 public function preview()
 {
     $mail_id = !empty($this->request->get['mail_id']) ? $this->request->get['mail_id'] : false;
     if (!$mail_id) {
         $this->backToHome();
     }
     $content = Mailer::getTemplate($mail_id);
     $this->response->setOutput('<title>' . $content['title'] . '</title><strong>Subject: ' . $content['title'] . '</strong><br /><hr />' . html_entity_decode($content['content']));
 }
开发者ID:wardvanderput,项目名称:SumoStore,代码行数:9,代码来源:emails.php

示例10: updateStatus

 public function updateStatus($order_id, $status_id, $sendMail = null, $comment = null)
 {
     $this->query("UPDATE PREFIX_orders SET order_status = :status WHERE order_id = :id", array('id' => $order_id, 'status' => $status_id));
     if ($sendMail == null) {
         $sendMail = $this->config->get('customer_notify_email');
     }
     if ($sendMail) {
         $order_info = $this->getOrder($order_id);
         Mailer::setOrder($order_info);
         Mailer::setCustomer($order_info['customer']);
         //$template = Mailer::getTemplate('update_order_status_' . $status_id, !empty($order_info['customer']['language_id']) ? $order_info['customer']['language_id'] : null);
         $template = Mailer::getTemplate('update_order_status_' . $status_id, null);
         Mail::setTo($order_info['customer']['email']);
         Mail::setSubject($template['title']);
         if ($comment != null) {
             $template['content'] = str_replace('{hasComments}', $comment, $template['content']);
         } else {
             $template['content'] = str_replace('{hasComments}', '', $template['content']);
         }
         Mail::setHTML($template['content']);
         Mail::send();
     }
 }
开发者ID:wardvanderput,项目名称:SumoStore,代码行数:23,代码来源:orders.php


注:本文中的Mailer::getTemplate方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。