Example #1
0
 public static function sendMailFromAgentThird($correo, $mensaje, $archivo = false)
 {
     $emails = explode(',', $correo);
     $to = array();
     foreach ($emails as $email) {
         $mail = $email;
         $destinatario = array('name' => $email, 'mail' => $email);
         if (($email = FilterInput::FilterValue($email, 'email', true)) === false) {
             throw new Exception('El correo ' . $mail . ' no es válido.');
         }
         $to[] = $destinatario;
     }
     $data = array('one' => $mensaje['one'], 'two' => $mensaje['two'], 'three' => $mensaje['three'], 'four' => $mensaje['four'], 'five' => $mensaje['five'], 'six' => $mensaje['six'], 'seven' => $mensaje['seven'], 'eight' => $mensaje['eight'], 'nine' => $mensaje['nine'], 'ten' => $mensaje['ten']);
     $tpl = ParserTemplate::parseTemplate('envio_inventario_third.html', $data);
     $correos = array(array('mail' => '*****@*****.**', 'name' => 'Jesús'), array('mail' => '*****@*****.**', 'name' => 'Vico'));
     if (Mailer::sendMail('Encuesta ONE / Tercer Review', $tpl, $to, '', $correos)) {
         return array('success' => true, 'message' => 'Correo enviado.');
     }
 }
Example #2
0
 public function addAttach($atach = array())
 {
     if (empty($atach)) {
         self::throwMailerException('Attach: Es necesario que agregues cuando menos un archivo.');
     }
     foreach ($atach as $file) {
         if (empty($file['file']) || empty($file['name'])) {
             self::throwMailerException('Attach: La lista de archivos no está en el formato correcto.');
         }
         $att = $file['file'];
         if (($nombre = FilterInput::FilterValue($file['name'], 'string', true)) === false) {
             self::throwMailerException('Attach: El nombre del destinatario no es correcto.');
         }
         $this->_mailer->AddAttachment($att, $nombre);
     }
 }