public function executeMassmail(sfWebRequest $r) { if (!$r->isMethod('post')) { $this->forward404(); } // Load form $f = new MailForm(); // Binding fields $f->bind($r->getParameter($f->getName())); // If everything is OK if ($f->isValid()) { // Loading email service $message = $this->getMailer()->compose(); // Setting object $message->setSubject(sfConfig::get("app_name", "ZenTracker CMS") . " : " . $f->getValue('title')); // The sender $message->setFrom($this->getUser()->getAttribute('ses')->getEmail()); // The body $message->setBody($f->getValue('content'), 'text/html'); $message->addPart(strip_tags($f->getValue('content')), 'text/plain'); // Member emails $emails = Doctrine_Query::create()->select('email')->from("Users")->execute(array(), Doctrine::HYDRATE_ARRAY); foreach ($emails as $email) { $message->setBcc($email['email']); } // Sending ! $this->getMailer()->send($message); // Redirect $this->redirect('@homepage'); } }