本文整理汇总了PHP中dm::enableMailer方法的典型用法代码示例。如果您正苦于以下问题:PHP dm::enableMailer方法的具体用法?PHP dm::enableMailer怎么用?PHP dm::enableMailer使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类dm
的用法示例。
在下文中一共展示了dm::enableMailer方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: initialize
protected function initialize()
{
dm::enableMailer();
$this->values = array();
$this->isRendered = false;
$this->message = Swift_Message::newInstance();
}
示例2: executeFormWidget
public function executeFormWidget(dmWebRequest $request)
{
$form = new OrderForm();
if ($request->hasParameter($form->getName()) && $form->bindAndValid($request)) {
$order = $form->save();
$order->setUid(md5(rand(1111, 9999) . time()));
$order->save();
// link order details
$this->shopping_cart = $shopping_cart = $this->getUser()->getShoppingCart();
$this->items = $shopping_cart->getItems();
foreach ($shopping_cart->getItems() as $i => $item) {
$od = new OrderDetail();
$od->fromArray(array('product_id' => $item->getId(), 'order_id' => $order->id, 'quantity' => $item->getQuantity(), 'price' => $item->getPrice()));
$od->save();
}
if (sfConfig::get('app_send_order', false)) {
dm::enableMailer();
//send mail
$message = $this->getMailer()->compose($_from = dmConfig::get('orderEmail'), $_to = array($order->email, dmConfig::get('orderEmail')), $_subj = '[' . dmConfig::get('siteName') . '] thanks for order');
$message->setBody($this->getPartial('order/mailOrder', array('order' => $order, 'companyName' => dmConfig::get('companyName'), 'companyPhone' => dmConfig::get('companyPhone'), 'siteUrl' => dmConfig::get('siteUrl'), 'siteName' => dmConfig::get('siteName'))));
$message->setContentType('text/html');
$this->getMailer()->send($message);
}
// if send order
// clear cart now
$shopping_cart->clear();
//redirect to order info
$this->redirect($this->getHelper()->link('main/ordershow?uid=' . $order->uid)->getHref());
//$this->redirectBack();
}
$this->forms['Order'] = $form;
}
示例3: realpath
<?php
require_once realpath(dirname(__FILE__) . '/../../..') . '/unit/helper/dmUnitTestHelper.php';
$helper = new dmUnitTestHelper();
$helper->boot();
$t = new lime_test();
$t->ok(!class_exists('Swift_Message'), 'Swift_Message class does not exist');
$t->info('Enable mailer');
dm::enableMailer();
$t->ok(class_exists('Swift_Message'), 'Swift_Message class now exists');