Ver Mensaje Individual
  #1 (permalink)  
Antiguo 17/06/2008, 15:39
Avatar de Devil
Devil
 
Fecha de Ingreso: agosto-2003
Ubicación: Cartagena
Mensajes: 59
Antigüedad: 20 años, 9 meses
Puntos: 0
Pregunta problema al enviar mail html con php

hola a todos como esta.. despues de haber buscado en el foro respuesta sobre mi duda no encontre una que me ayudara con el problema que tengo... mi problema es el siguiente tengo un script en php con este codigo:

[CODE]
require_once(cmailer.php");
$consulta="select eid,custname,category,content,CRMentity.status,pri ority,duedate,CRMentity.owner,assignee
from CRMentity,CRMcustomer,CRMloginusers
where duedate<>''
and cast(concat(substring(duedate,7,4),'-',substring(duedate,4,2),'-',substring(duedate,1,2)) as date)<'".$hoy."'
and CRMentity.status<>'Cerrado'
and CRMcustomer.id=CRMentity.eid
and CRMentity.owner=CRMloginusers.id";
$resul=mcq($consulta,$db);
$num_filas=mysql_num_rows($resul);


$insertrep_acv="insert into CRMreporte_acv(cantidad_acv,fecha) values ('$num_filas','$hoy')";
$insert_repacv=mysql_query($insertrep_acv);


$rep_acv="SELECT id,reporte from CRMreporte_acv WHERE fecha='".$hoy."'";
$resul_acv=mysql_query($rep_acv);
$row_acv=mysql_fetch_array($resul_acv);


if($resul>0){
$reporte="<table border=1 align='center' width=100%>
<TR>
<td colspan='9' align='center'><font size='2'><b>Reporte de Actividades Vencidas</b></font></td>
</TR>
<TR>
<TD align='center'>Id</TD>
<TD align='center'>Cliente</TD>
<TD align='center'>Categoria</TD>
<TD align='center'>Comentario</TD>
<TD align='center'>Estado</TD>
<TD align='center'>Prioridad</TD>
<TD align='center'>F. Inicio</TD>
<TD align='center'>F.Finalización</TD>
</TR>";
while($row=mysql_fetch_array($resul)){

$reporte.="<TR>
<TD align='center'>$row['eid']</TD>
<TD align='center'>$row['custname']</TD>
<TD align='center'>$row['category']</TD>
<TD align='center'>$row['content']</TD>
<TD align='center'>$row['status']</TD>
<TD align='center'>$row['priority']</TD>
<TD align='center'>$row['startdate']</TD>
<TD align='center'>$row['duedate']</TD>
</TR>";
}
$reporte.="</table>";
}else{
echo "Error de Conexion a la Base de Datos";
}
//-----------Envio de Correo
$cabecera= "MIME-Version: 1.0\n";
$cabecera.= "Content-Type: text/html; charset=iso-8859-1\n";
$cabecera.= "X-Mailer: PHP/";
$cabecera.="Resumen de Actividades Vencidas"."\n\n"
."Reporte No.:".$row_acv['id']." - "."Del: ".$row_acv['reporte']." - "."Número de Actividades Vencidas:".$num_filas."\n\n";
$para="[email protected]";
$de=""[email protected]";
$asunto="Actividades Vencidas";
$mensaje=$cabecera.$reporte;
$hosting="xxxx.com";

$m = new cMailer();
$m->AddAddress($para);
//$m->AddAddress("[email protected]");
$m->AddSender($de);
$m->AddSubject($asunto);
$m->AddMessage($mensaje);
$m->AddHost($hosting);
$m->Send();
[/CODE

y el codigo del escript que incluyo arriba es
Código:
<?

class cMailer{

	var $_Addresses;
	var $_countAdd = 0;
	var $_ConexionSMTP;
	var $_Sender;
	var $_server;
	var $_Subject = "";

	function cMailer(){
	}

	function AddAddress($address){
		$this->_Addresses[$this->_countAdd] = $address;
		$this->_countAdd++;
	}

	function AddSender($sender){
		$this->_Sender = $sender;
	}

	function AddMessage($message){
		$this->_Message = $message;
	}

	function AddSubject($subject){
		$this->_Subject = $subject;
	}

	function Send(){

		$strEHLO = "HELO ".$this->_server."\r\n";
		fputs($this->_ConexionSMTP,$strEHLO);

		$strMAIL = "MAIL FROM: ".$this->_Sender."\r\n";
		fputs($this->_ConexionSMTP,$strMAIL);

		for($i=0;$i<$this->_countAdd;$i++){
			$strRCPT .= "RCPT TO: ".$this->_Addresses[$i]."\r\n";
		}
		$strRCPT .= "\r\n";
		fputs($this->_ConexionSMTP,$strRCPT);


		$strDATA1 = "DATA\r\n";
		fputs($this->_ConexionSMTP,$strDATA1);
		

		if($this->_Subject != ""){

			$strS = "Subject: ".$this->_Subject."\r\n\r\n";
			fputs($this->_ConexionSMTP,$strS);
		}


		$strDATA2 = $this->_Message."\r\n.\r\n";
		fputs($this->_ConexionSMTP,$strDATA2);
		
		fputs($this->_ConexionSMTP,"QUIT\r\n");
		fclose($this->_ConexionSMTP);
	
	}

	function AddHost($host,$port=25){
		$this->_ConexionSMTP = fsockopen("$host","$port",$e,$em,5) or die("no puedorl");
		echo fgets($this->_ConexionSMTP,4096);
		$this->_server = $host;
	}

}
?>
estoy tratando de que lo que tengo en el primer escript se vaya por mail en formato html pero no lo envia que podría estar haciendo mal???
__________________
Devil...La Verdad Os Hara Libres...El Conocimiento Invensible