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


PHP MailTemplate::getEmailMessage方法代码示例

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


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

示例1: viewAction

 /**
  * View detail post action.
  */
 public function viewAction()
 {
     $config = Zend_Registry::get('config');
     $this->view->headScript()->appendFile($config->baseurl . '/js/jquery.validate.min.js');
     $this->view->headScript()->appendFile($config->baseurl . '/js/view.js');
     $this->view->class = "view";
     $city = $this->_getParam('city');
     $id = $this->_getParam('id');
     $advertisement = $this->advertisement->findById($id);
     if (isset($advertisement)) {
         $this->view->viewMode = 'detail';
         $this->view->advertisement = $advertisement;
         $form = new SendIntrestMail($advertisement, $city);
         $this->view->form = $form;
         $cityObj = $this->city->findByName($city);
         $this->view->pageTitle = $advertisement->title . "| 租个房子 - " . $cityObj->name_cn_long;
         $pageDesc = "";
         if ($advertisement->type == "want") {
             $this->view->pageImage = "want";
             $pageDesc = $pageDesc . "最高房租:" . $advertisement->rent . $this->_helper->RentFormat($advertisement) . " | ";
             $pageDesc = $pageDesc . "最小面积:" . $advertisement->area . "平方米  | ";
             $pageDesc = $pageDesc . "时间:" . $advertisement->start_date;
             if ($this->_helper->DateIsValid($advertisement->stop_date)) {
                 $pageDesc = $pageDesc . "到" . $advertisement->stop_date;
             } else {
                 $pageDesc = $pageDesc . "起长期";
             }
             $pageDesc = $pageDesc . "\n描述:" . $advertisement->description;
         } else {
             $this->view->pageImage = "lease";
             $pageDesc = $pageDesc . "地址:" . $advertisement->address . " | ";
             $pageDesc = $pageDesc . "房租: " . $advertisement->rent . $this->_helper->RentFormat($advertisement) . " | ";
             $pageDesc = $pageDesc . "时间:" . $advertisement->start_date;
             if ($this->_helper->DateIsValid($advertisement->stop_date)) {
                 $pageDesc = $pageDesc . "到" . $advertisement->stop_date;
             } else {
                 $pageDesc = $pageDesc . "起长期";
             }
             $pageDesc = $pageDesc . "\n描述:" . $advertisement->description;
         }
         if ($advertisement->category_id == Category::SHOP) {
             $this->view->pageImage = "business";
         }
         $this->view->pageDesc = $pageDesc;
         if ($this->getRequest()->isPost()) {
             if ($form->isValid($_POST)) {
                 //					$isValid = $this->_helper->common->validReCaptcha ($this->_getAllParams());
                 //					if ($isValid) {
                 $id = $form->getValue('id');
                 $city = $form->getValue('city');
                 // sender name
                 $name = $form->getValue('name');
                 // sender email
                 $email = $form->getValue('email');
                 // body
                 $body = $form->getValue('body');
                 $advertisement = $this->advertisement->findById($id);
                 $user = Advertisement::getUser($id);
                 //$this->_helper->swiftEmail->sendEmail($body, Advertisement::getUser($advertisement->id)->email, $email, '租个房子');
                 $db = Zend_Registry::get('db');
                 $db->beginTransaction();
                 $data = array('name' => trim($name), 'email' => trim($email));
                 $sendUser = $this->user->addUser($data);
                 $message = MailTemplate::getEmailMessage($name, $email, $user->email, $body, $advertisement, MailTemplate::SENDER_MAIL_BODY);
                 $subject = MailTemplate::getEmailSubject($advertisement->title, MailTemplate::SUBJECT_SEND_TO_OWNER);
                 $mailId = $this->mailQueue->addToQueue(MailType::USER, $name, $subject, $email, $user->email, $message, $this->_helper->generator->generateCurrentTime());
                 // add advertisement response
                 $this->advertisementResponse->addAdvertisementResponse($id, $sendUser->id, $mailId);
                 $message = MailTemplate::getEmailMessage($name, $email, $user->email, $body, $advertisement, MailTemplate::SENDER_RECIEPT_BODY);
                 $subject = MailTemplate::getEmailSubject($advertisement->title, MailTemplate::SUBJECT_SENDER_RECEIPT);
                 $this->mailQueue->addToQueue(MailType::USER, $name, $subject, Constant::SYSTEM_MAIL, $email, $message, $this->_helper->generator->generateCurrentTime());
                 $this->_flashMessenger->addMessage("您的邮件已成功发给贴主了!请等待回音!因为房源紧张,所以可能不会收到贴主的回复。请多找几处。最好电话联系!谢谢您的支持!!");
                 $db->commit();
                 $this->_redirect('/' . $city . '/bulletin/view/' . $advertisement->id);
                 //					} else {
                 ////						throw new Exception ( '验证码错误!' );
                 //					}
             }
         }
     } else {
         throw new Exception('帖子ID缺失或者帖子未找到!');
     }
 }
开发者ID:BGCX262,项目名称:zufangzi-svn-to-git,代码行数:86,代码来源:BulletinController.php


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