本文整理匯總了PHP中sfMailer::send方法的典型用法代碼示例。如果您正苦於以下問題:PHP sfMailer::send方法的具體用法?PHP sfMailer::send怎麽用?PHP sfMailer::send使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類sfMailer
的用法示例。
在下文中一共展示了sfMailer::send方法的1個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。
示例1: sendNotificationEmail
static function sendNotificationEmail($name, sfMailer $mailer, aPollPoll $poll, aPollAnswer $answer)
{
if (!self::getSendNotification($name)) {
return false;
}
sfContext::getInstance()->getConfiguration()->loadHelpers('Partial');
$from = self::isUserOrEmail(self::getNotificationEmailFrom($name), true);
$to = self::isUserOrEmail(self::getNotificationEmailTo($name), true);
if (is_null($to)) {
throw new sfException('No destination email defined. Cannot send a notification.');
}
$form_name = aPollToolkit::getPollFormName($poll->getType());
$arguments = array('poll' => $poll, 'poll_form' => new $form_name($answer->getFieldsAsArray()), 'answer' => $answer);
$message = $mailer->compose($from, $to);
//$message->setContentType("text/html");
$message->setSubject(get_partial(self::getNotificationEmailTitlePartial($name), $arguments));
$body = get_partial(self::getNotificationEmailBodyPartial($name), $arguments);
$message->addPart(self::createPlainTextBody($body), 'text/plain');
$message->addPart(self::createHtmlBody($poll->getType(), $body), 'text/html');
$mailer->send($message);
return true;
}