Beispiel #1
0
 public static function EnviaMissatge($IDM, $idS)
 {
     $M = MissatgesllistesPeer::retrieveByPK($IDM);
     require_once 'lib/vendor/swift/swift_init.php';
     # needed due to symfony autoloader
     $mailer = Swift_Mailer::newInstance(Swift_MailTransport::newInstance());
     $MAILS = UsuarisllistesPeer::getUsuarisLlistaEmail($M->getLlistesIdllistes());
     foreach ($MAILS as $Email) {
         $message = Swift_Message::newInstance($M->getTitol())->setFrom(OptionsPeer::getString('MAIL_FROM', $idS))->setTo($Email)->setBody($M->getText(), 'text/html');
         $mailer->send($message);
     }
     $M->setEnviat(date('Y-m-d', time()));
     $M->save();
     return sizeof($MAILS);
 }