本文整理汇总了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缺失或者帖子未找到!');
}
}