getSMTPServer(); //Por compatibilidad if(empty($server)) $params= array('host'=>'smtp.gva.es'); else $params= $server; $mail_object = Mail::factory('smtp', $params); foreach (self::$mailQueue as $mail) { $result = $mail_object->send($mail[0], $mail[1], $mail[2]); if (!$result || !($result === TRUE)) IgepDebug::setDebug(WARNING, 'Ha Fallado el envío de correo a "'.$mail[1]['To'].'" con asunto '.$mail[1]['Subject'].'"'); } self::$mailQueue = array(); } /**Función para enviar correos con ficheros anexados * from --> Contiene la dirección de correo del usuario que envia * to --> Contiene un array con los destinatarios * subject --> Asunto del mensaje. * msg --> Texto del mensaje. * responder_a --> Contiene la dirección de correo del usuario a responder * tmp_fich --> Nombre del fichero temporal anexo a enviar en el mensaje. * tipofich --> Tipo de fichero * nom_fich --> Nombre del fichero anexo a enviar en el mensaje */ /*Se usa el paquete mail_mime (http://pear.php.net/package-info.php?pacid=21): * - mime.php: Create mime email, with html, attachments, embedded images etc. * - mimePart.php: Advanced method of creating mime messages. * - mimeDecode.php - Decodes mime messages to a usable structure. * - xmail.dtd: An XML DTD to acompany the getXML() method of the decoding class. * - xmail.xsl: An XSLT stylesheet to transform the output of the getXML() method back to an email */ static public function conAnexo($from,$to,$subject,$msg,$responder_a,$tmp_fich,$tipo_fich,$nom_fich) { ////////////////////// NO ESTÁ PROBADA //////////////////////////// $numTo = 0; if (is_array($to)) { $numTo = count($to); } IgepDebug::setDebug(DEBUG_IGEP, 'Enviando correo con anexo a '.count($numTo).' usuario(s)'); //Cabeceras: $hdrs = array('From'=>$from,'Subject' => $subject,'Reply-to'=> $responder_a); //Creamos el objeto de tipo Mail_mime: $mime = new Mail_mime(SALTO_LINEA); if (!$mime->addAttachment($tmp_fich,$tipo_fich,$nom_fich)) $msg.= SALTO_LINEA." No ha podido anexarse el fichero"; $mime->setTXTBody($msg); $body = $mime->get(); $hdrs = $mime->headers($hdrs); //Recogemos el servidor de SMTP $conf = ConfigFramework::getConfig(); $server = $conf->getSMTPServer(); //Por compatibilidad if(empty($server)) $params= array('host'=>'smtp.gva.es'); else $params= $server; // Creamos el objeto mail usando el método Mail::factory $mail_object =& Mail::factory('smtp', $params); //Mandamos el mensaje a cada destinatario: $resultado=TRUE; while (list(, $valor)=each($to)) { $result = $mail_object->send($valor, $hdrs, $body); if (!$result || !($result === TRUE)) $resultado=FALSE; } return $resultado; } } //Fin de la Clase correo ?>