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; }