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


PHP Mail::setTemplate方法代码示例

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


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

示例1: actSave

 function actSave()
 {
     global $ST, $post, $get;
     $id = $post->getInt('id');
     $field = array('time' => $post->get('time'), 'name' => $post->get('name'), 'mail' => $post->get('mail'), 'phone' => $post->get('phone'), 'theme' => $post->get('theme'), 'comment' => $post->get('comment'), 'answer' => $post->get('answer'), 'order_num' => $post->get('order_num'));
     if ($id) {
         $ST->update('sc_guestbook', $_POST, "id=" . $id);
     } else {
         $id = $ST->insert('sc_guestbook', $post->get());
     }
     if ($get->exists('type') == 'save_with_notice') {
         $mail = new Mail();
         $mail->setFromMail(array($this->cfg('SITE'), $this->cfg('mail')));
         $mail->setTemplate('letter_guestbook', array('FROM_SITE' => $this->cfg('SITE'), 'COMMENT' => $field['comment'], 'ANSWER' => $field['answer'], 'NAME' => $field['name']));
         $mail->xsend($field['mail']);
     }
     echo printJSON(array('msg' => 'Сохранено', 'id' => $id));
     exit;
 }
开发者ID:AlexanderWhi,项目名称:tplshop2,代码行数:19,代码来源:AdminGuestbook.class.php

示例2: processreviewAction

 /**
  * Action that processes a review after submission
  * @author philipperigaux
  *
  */
 function processreviewAction()
 {
     if (!$this->config->isPhaseOpen(Config::REVIEWING_PHASE)) {
         $this->view->content = $this->texts->reviewer->review_phase_is_closed;
         echo $this->view->render("layout");
         return;
     }
     $this->view->setFile("content", "processreview.xml");
     $this->view->setBlock("content", "review");
     // Extract the block with marks.
     $this->view->set_block('review', "review_mark", "review_marks");
     // Extracts the block with answers
     $this->view->set_block('review', "review_answer", "review_answers");
     // Actions if the id of a paper is submitted
     if (isset($_REQUEST['idPaper'])) {
         $idPaper = $this->getRequest()->getParam("idPaper");
         $reviewTbl = new Review();
         $review = $reviewTbl->find($idPaper, $this->user->id)->current();
         // Check that the paper is REALLY assigned to the reviewer
         if (is_object($review)) {
             // Put the review in the database
             $review->updateFromArray($_POST);
             // Create the review presentation
             $this->view->review = $review->showReview($this->view, true);
             // Resolve the entities replacement
             $this->view->assign("content", "content");
             // Send a mail to confirm review submission
             $mail = new Mail(Mail::SOME_USER, $this->texts->mail->subj_ack_review, $this->view->getScriptPaths());
             $mail->setFormat(Mail::FORMAT_HTML);
             $mail->setTo($this->user->email);
             $mail->loadTemplate($this->lang, "ack_review");
             $mailViewEngine = $mail->getEngine();
             // Fixes a bug: the reviewer namespace is not present, and thus 'reviewer' texts
             // were not translated. NB: this requires a fix ubn Zmax_Translate_Db as well
             $this->texts->addTranslation($this->zmax_context->db, $this->zmax_context->locale, array("namespace" => 'reviewer', "view" => $mailViewEngine));
             $mailViewEngine->setBlock("template", "template_mark", "template_marks");
             $mailViewEngine->setBlock("template", "template_answer", "template_answers");
             $instantiatedMail = $review->showReview($mailViewEngine, true, "template");
             $mail->setTemplate($instantiatedMail);
             if ($this->config->mailOnReview == "Y") {
                 $mail->setCopyToChair(true);
             }
             $mail->send();
         } else {
             $this->view->content = $this->texts->def->access_denied;
         }
     } else {
         $this->view->content = "Invalid action<br/>";
     }
     echo $this->view->render("layout");
 }
开发者ID:camilorivera,项目名称:INNOVARE,代码行数:56,代码来源:ReviewerController.php

示例3: notifyAction

 /**
  * Send the status to authors, with anonymous reviews
  */
 function notifyAction()
 {
     $db = $this->zmax_context->db;
     $paperTbl = new Paper();
     $paperStatusTbl = new PaperStatus();
     // Load the reviews template
     $this->view->setFile("review", "review4author.xml");
     $this->view->setBlock("review", "review_mark", "review_marks");
     $this->view->setBlock("review", "review_answer", "review_answers");
     // Set the subject
     $subject = $this->texts->mail->subj_notification;
     if (isset($_REQUEST['id_paper'])) {
         // Mail for one paper
         $idPaper = $_REQUEST['id_paper'];
         $this->view->setFile("content", "showmessage.xml");
         $this->view->setBlock("content", "WARNING_TEMPLATE", " ");
         $paper = $paperTbl->find($idPaper)->current();
         if (!empty($paper->status)) {
             $paper->putInView($this->view);
             $this->view->reviews = $paper->showReviews($this->view);
             $statusRow = $paperStatusTbl->find($paper->status)->current();
             $mail = new Mail(Mail::SOME_USER, $subject, $this->view->getScriptPaths());
             $mail->setTo($paper->emailContact);
             $mail->setFormat(Mail::FORMAT_HTML);
             $mail->loadTemplate($this->lang, $statusRow->mailTemplate);
             // We know the paper, so we can instantiate the mail entities
             $this->view->setVar("mailTemplate", $mail->getTemplate());
             $this->view->assign("mailTemplate", "mailTemplate");
             $mail->setTemplate($this->view->mailTemplate);
             // Put in the view
             $mail->putInView($this->view);
         } else {
             $this->content = "Cannot send notification without a status<br/>";
         }
         echo $this->view->render("layout");
         return;
     } else {
         // Batch mail. Check that all papers have a status,
         // and that there are no missing reviews
         $this->view->setFile("content", "notify.xml");
         $this->view->setBlock("content", "TEMPLATE", "TEMPLATES");
         $res = $db->query("SELECT count(*) AS count FROM Paper p, PaperStatus s " . " WHERE p.status = s.id AND final_status != 'Y'");
         $p = $res->fetch(Zend_Db::FETCH_OBJ);
         if ($p->count > 0) {
             $this->view->content = "Cannot send notification mails: some papers do not have a status";
             echo $this->view->render("layout");
             exit;
         }
         $qReview = "SELECT count(*) AS count FROM Review WHERE overall IS NULL";
         $res = $db->query($qReview);
         $p = $res->fetch(Zend_Db::FETCH_OBJ);
         if ($p->count > 0) {
             $this->view->content = "Cannot send notification mails: missing reviews";
             echo $this->view->render("layout");
             exit;
         }
         // OK. Now give the list of the templates that will be used
         $i = 0;
         $paperStatusList = $paperStatusTbl->fetchAll("final_status = 'Y'");
         $mail = new Mail(Mail::SOME_USER, "", $this->view->getScriptPaths());
         foreach ($paperStatusList as $paperStatus) {
             $this->view->css_class = Config::CssCLass($i++);
             $paperStatus->putInView($this->view);
             $mail->loadTemplate($this->lang, $paperStatus->mailTemplate);
             $this->view->setVar("template_content-{$paperStatus->id}", $mail->getTemplate());
             $this->view->assign("template_content", "template_content-{$paperStatus->id}");
             $this->view->append("TEMPLATES", "TEMPLATE");
         }
         // Send the notification mails.
         $messages = "";
         if (isset($_REQUEST['confirmed']) or isset($_REQUEST['export'])) {
             PaperRow::$loadAbstracts = false;
             $papers = $paperTbl->fetchAll();
             $mail = new Mail(Mail::SOME_USER, $subject, $this->view->getScriptPaths());
             $mail->setFormat(Mail::FORMAT_HTML);
             $mail->setCopyToChair(true);
             foreach ($papers as $paper) {
                 $statusRow = $paperStatusTbl->find($paper->status)->current();
                 $mail->setTo($paper->emailContact);
                 $mail->loadTemplate($this->lang, $statusRow->mailTemplate);
                 $paper->putInView($mail->getEngine());
                 $mail->getEngine()->reviews = $paper->showReviews($this->view);
                 if (isset($_REQUEST['confirmed'])) {
                     $mail->send();
                 } else {
                     $messages .= $mail->getMessage() . "\n\n";
                 }
             }
         }
     }
     if (isset($_REQUEST['export'])) {
         header("Content-disposition: attachment; filename=notificationMails.txt");
         header("Content-Type: application/force-download");
         header("Content-Transfer-Encoding: text\n");
         header("Content-Length: " . strlen($messages));
         header("Pragma: no-cache");
         header("Cache-Control: must-revalidate, post-check=0, pre-check=0, public");
//.........这里部分代码省略.........
开发者ID:camilorivera,项目名称:INNOVARE,代码行数:101,代码来源:MailController.php

示例4: actSave

 function actSave()
 {
     global $ST, $get, $post;
     $id = $post->getInt('id');
     $data = array('content' => $post->get('content'), 'description' => $post->get('description'), 'title' => $post->get('title'), 'author' => $post->get('author'), 'date' => dte($post->get('date'), 'Y-m-d'), 'state' => $post->get('state'), 'category' => $post->getInt('category'), 'position' => $post->getInt('position'), 'gallery' => $post->getInt('gallery'), 'type' => $this->getType());
     $img_out = "";
     if (!empty($_FILES['upload']['name']) && isImg($_FILES['upload']['name'])) {
         $img = $this->cfg('NEWS_IMAGE_PATH') . '/' . md5($_FILES['upload']['tmp_name']) . "." . file_ext($_FILES['upload']['name']);
         move_uploaded_file($_FILES['upload']['tmp_name'], ROOT . $img);
         $data['img'] = $img;
         $img_out = scaleImg($img, 'w200');
     }
     if ($post->getInt('clear')) {
         $data['img'] = '';
     }
     if ($id) {
         $ST->update('sc_news', $data, "id=" . $id);
     } else {
         $id = $ST->insert('sc_news', $data);
     }
     $ST->delete('sc_relation', "parent={$id} AND type='public'");
     foreach ($post->getArray('public_rel') as $v) {
         $ST->insert('sc_relation', array('parent' => $id, 'type' => 'public', 'child' => $v));
     }
     $msg = "Сохранено";
     if (true) {
         $content = '';
         $content .= '<small>' . date('d.m.Y') . '</small> ';
         $content .= '<strong>' . $post->getHtml('title') . '</strong><br />';
         $content .= '<span>' . $post->getHtml('description') . '</span><br />';
         $content .= '<a href="http://' . $this->cfg('SITE') . '/' . $post->get('type') . '/' . $id . '/">подробнее...</a>';
         if ($post->exists('save_and_send')) {
             $mail = new Mail();
             $mail->setFromMail(array($this->cfg('SITE'), $this->cfg('mail')));
             $key = 'http://' . $this->cfg('SITE') . '/cabinet/unsubscribe/?key=' . md5($this->getUser('mail') . $this->getType() . 'unsubscribe') . '&type=' . $this->getType() . '&mail=' . $this->getUser('mail');
             $key = '<a href="' . $key . '">' . $key . '</a>';
             $mail->setTemplate('letter_' . $this->getType(), array('FROM_SITE' => $this->cfg('SITE'), 'CONTENT' => $content, 'BODY' => $post->get('content'), 'TITLE' => $post->get('title')));
             $mail->xsend($this->getUser('mail'), array('UNSUBSCRIBE' => $key));
         } elseif ($post->exists('save_and_send_all')) {
             $q = "SELECT distinct mail,id FROM sc_subscribe WHERE type LIKE '%" . $this->getType() . "%' \r\n\t\t\t\tAND NOT EXISTS(SELECT mailid FROM sc_news_sendlog WHERE id=mailid AND newsid={$id}){$this->getMailFilter()}";
             if ($post->getInt('pack')) {
                 $q .= " LIMIT {$post->getInt('pack')}";
             }
             $rs = $ST->select($q);
             $mail = new Mail();
             //				$mail->setFromMail($this->getConfig('mail'));
             $mail->setFromMail(array($this->cfg('SITE'), $this->cfg('mail')));
             $mail->setTemplate('letter_' . $this->getType(), array('FROM_SITE' => $this->cfg('SITE'), 'CONTENT' => $content, 'BODY' => $post->get('content'), 'TITLE' => $post->get('title')));
             $n = 0;
             while ($rs->next()) {
                 if (check_mail($m = trim($rs->get('mail')))) {
                     $key = 'http://' . $this->cfg('SITE') . '/cabinet/unsubscribe/?key=' . md5($rs->get('mail') . $this->getType() . 'unsubscribe') . '&type=' . $this->getType() . '&mail=' . $rs->get('mail');
                     $key = '<a href="' . $key . '">' . $key . '</a>';
                     $mail->xsend($m, array('UNSUBSCRIBE' => $key));
                     $ST->insert('sc_news_sendlog', array('mailid' => $rs->get('id'), 'newsid' => $id));
                     $n++;
                 } else {
                     $ST->delete('sc_subscribe', "mail='" . SQL::slashes($rs->get('mail')) . "'");
                 }
             }
             $msg .= " отправлено {$n}";
         }
     }
     echo printJSONP(array('msg' => $msg, 'id' => $id, 'img' => $img_out));
     exit;
 }
开发者ID:AlexanderWhi,项目名称:tplshop2,代码行数:66,代码来源:AdminArticle.class.php

示例5: actSave

 function actSave()
 {
     global $ST, $get, $post;
     $id = $post->getInt('id');
     $data = array('content' => $post->get('content'), 'description' => $post->get('description'), 'title' => $post->get('title'), 'author' => $post->get('author'), 'date' => dte($post->get('date'), 'Y-m-d'), 'date_to' => $post->get('date_to') ? dte($post->get('date_to'), 'Y-m-d') : null, 'state' => $post->get('state'), 'img' => $post->get('img'), 'gallery' => $post->getInt('gallery'), 'position' => $post->getInt('position'), 'type' => $this->getType());
     if ($data['img'] && file_exists(ROOT . $data['img'])) {
         $from = ROOT . $data['img'];
         $name = md5_file(ROOT . $data['img']) . '.' . substr($data['img'], -3);
         $path = $this->cfg('NEWS_IMAGE_PATH') . '/' . $name;
         $data['img'] = $path;
         if (!file_exists(ROOT . $data['img'])) {
             rename($from, ROOT . $data['img']);
         }
     } elseif ($data['img'] == 'clear') {
         $data['img'] = '';
     }
     if ($id) {
         $ST->update('sc_news', $data, "id=" . $id);
     } else {
         $id = $ST->insert('sc_news', $data);
     }
     if (true) {
         $content = '';
         if ($post->get('type') == 'news') {
             $content .= '<small>' . date('d.m.Y') . '</small> ';
         }
         $content .= '<strong>' . $post->getHtml('title') . '</strong><br />';
         $content .= '<span>' . $post->getHtml('description') . '</span><br />';
         $content .= '<a href="http://' . $this->cfg('SITE') . '/' . $post->get('type') . '/view/' . $id . '/">подробнее...</a>';
         if ($get->exists('save_and_send')) {
             $mail = new Mail();
             $mail->setFromMail(array($this->cfg('SITE'), $this->cfg('mail')));
             $mail->setTemplate('letter_' . $post->get('type'), array('FROM_SITE' => $this->cfg('SITE'), 'CONTENT' => $content, 'BODY' => $post->get('content')));
             $mail->xsend($this->getUser('mail'));
         } elseif ($get->exists('save_and_send_all')) {
             $rs = $ST->execute("SELECT distinct mail FROM sc_subscribe WHERE type LIKE '%" . $post->get('type') . "%'");
             $mail = new Mail();
             $mail->setFromMail($this->getConfig('mail'));
             $mail->setFromMail(array($post->get('title'), $this->cfg('mail')));
             $mail->setTemplate('letter_' . $post->get('type'), array('FROM_SITE' => $this->cfg('SITE'), 'CONTENT' => $content, 'BODY' => $post->get('content')));
             while ($rs->next()) {
                 $key = 'http://' . $this->cfg('SITE') . '/cabinet/unsubscribe/?key=' . md5($rs->get('mail') . $post->get('type') . 'unsubscribe') . '&type=' . $post->get('type') . '&mail=' . $rs->get('mail');
                 $key = '<a href="' . $key . '">' . $key . '</a>';
                 $mail->xsend($rs->get('mail'), array('UNSUBSCRIBE' => $key));
             }
         }
     }
     echo printJSON(array('msg' => 'Сохранено', 'nws_id' => $id));
     exit;
 }
开发者ID:AlexanderWhi,项目名称:tplshop2,代码行数:50,代码来源:AdminNews.class.php

示例6: sendTemplateMail

 function sendTemplateMail($to, $templateName, $varList = null, $attachments = array())
 {
     $FROM_MAIL = FROM_MAIL;
     $varList = array_merge($varList, array('FROM_SITE' => FROM_SITE));
     if ($mail = $this->cfg("FROM_MAIL")) {
         $FROM_MAIL = $mail;
     }
     if (isset($varList['from_mail'])) {
         $FROM_MAIL = $varList['from_mail'];
     }
     $mail = new Mail();
     $mail->setTemplate($templateName, $varList);
     $mail->setFromMail($FROM_MAIL);
     foreach ($attachments as $a) {
         $mail->addAttachment($a);
     }
     $mail->xsend($to, $varList);
 }
开发者ID:AlexanderWhi,项目名称:tplshop2,代码行数:18,代码来源:BaseComponent.class.php

示例7: dirname

}
$id = strtotime($last_date);
$q = "SELECT * FROM sc_shop_item i,sc_shop_proposal p,sc_users v WHERE p.itemid=i.id AND i.vendor=v.u_id AND p.create_time>'{$last_date}'";
$rs = DB::select($q)->toArray();
if (!$rs) {
    exit;
}
ob_start();
include dirname(__FILE__) . "/catalog_subscribe.tpl.php";
$content = ob_get_contents();
ob_end_clean();
$type = 'catalog';
$mail = new Mail();
//	$mail->setFromMail($this->getConfig('mail'));
$mail->setFromMail(array(Cfg::get('SITE'), Cfg::get('mail')));
$mail->setTemplate('letter_catalog', array('FROM_SITE' => Cfg::get('SITE'), 'CONTENT' => $content));
$q = "SELECT distinct mail,id FROM sc_subscribe WHERE type LIKE '%" . $type . "%' \n\t\t\t\tAND NOT EXISTS(SELECT mailid FROM sc_news_sendlog WHERE id=mailid AND newsid={$id})";
$rs = DB::select($q);
$n = 0;
while ($rs->next()) {
    if (check_mail($m = trim($rs->get('mail')))) {
        $key = 'http://' . Cfg::get('SITE') . '/cabinet/unsubscribe/?key=' . md5($rs->get('mail') . $type . 'unsubscribe') . '&type=' . $type . '&mail=' . $rs->get('mail');
        $key = '<a href="' . $key . '">' . $key . '</a>';
        $mail->xsend($m, array('UNSUBSCRIBE' => $key));
        DB::insert('sc_news_sendlog', array('mailid' => $rs->get('id'), 'newsid' => $id));
        $n++;
    } else {
        DB::delete('sc_subscribe', "mail='" . SQL::slashes($rs->get('mail')) . "'");
    }
}
$rs = DB::select("SELECT MAX(create_time) AS m FROM sc_shop_proposal");
开发者ID:AlexanderWhi,项目名称:tplshop2,代码行数:31,代码来源:catalog_subscribe.php


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