Acá se genera el mensaje y se almacena
Código PHP:
$CabeceraHtml = "<!DOCTYPE HTML PUBLIC '-//W3C//DTD HTML 4.01 Transitional//EN'
'http://www.w3.org/TR/html4/loose.dtd'><html><head><title>$asunto</title>
<meta http-equiv='Content-Type' content='text/html; charset=ISO-8859-1'></head><body>";
$CierreCabeceraHtml = "</body></html>";
$logo = "<tr ><td><img alt='logo' src='cid:logo' width='150px' height='75px' /></td></tr>";
$CuerpoMensaje = $salida1.$salida2.$logo.$salida3.$parrafos.$postdata;
$_SESSION['mensaje'] = $CabeceraHtml.$CuerpoMensaje.$CierreCabeceraHtml;
En el mismo script se llama al metodo de envio, en otro archivo:
Código PHP:
function circularEmision($asunto, $nombre, $email){
$this->emailNombre = "algo";
$this->emailDesde = "[email protected]";
//armo cuerpo mensaje
/*$CabeceraHtml = "<!DOCTYPE HTML PUBLIC '-//W3C//DTD HTML 4.01 Transitional//EN'
'http://www.w3.org/TR/html4/loose.dtd'><html><head><title>$asunto</title>
<meta http-equiv='Content-Type' content='text/html; charset=ISO-8859-1'></head><body>";
$CierreCabeceraHtml = "</body></html>";
$logo = "<tr ><td><img alt='logo' src='cid:logo' width='150px' height='75px' /></td></tr>";
$CuerpoMensaje = $_SESSION['salidaInicioEmailNotificacionBaja'].$logo.$_SESSION['salidaFinalEmailNotificacionBaja'];
$cuerpoMensaje = $CabeceraHtml.$CuerpoMensaje.$CierreCabeceraHtml;*/
$r=$this->EnviarCorreo($asunto, $nombre , $email, $_SESSION['mensaje']);
if ($r) $msg = "$asunto enviada a <br> <b>$nombre</b> - Email: <b>$email</b>";
else $msg = "ERROR !!!! <BR> EL CORREO NO PUDO SER ENVIADO A <b>$nombre</b> <br> Email: <b>$AEmail</b> <br> VERIFICAR DIRECCION DE EMAIL Y CONEXION A INTERNET. <BR>";
return $r;
}
function EnviarCorreo($AsuntoIn, $to_name, $to_email, $mensaje) {
$mail = new PHPMailer();
$mail->IsSMTP(); // set mailer to use SMTP
$mail->Host = "smtp.algo.com"; // specify main and backup server
$mail->SMTPAuth = true; // turn on SMTP authentication
$mail->Username = "[email protected]"; // SMTP username
$mail->Password = "algo";
$mail->From = $this->emailDesde;
$mail->FromName = $this->emailNombre;
$mail->AddAddress($to_email,$to_name);
$mail->AddReplyTo($from_email,$from_name);
$mail->IsHTML(true);
$mail->Subject = $AsuntoIn;
$mail->AddEmbeddedImage("../images/logo.png","logo","logo.png");
$mail->Body = $mensaje;
//return true;
return $mail->Send();
}
Las lineas comentadas corresponde al armado del mensaje que funciona bien, pero si quiero que funcione tal como está el código ahora, no lo hace, la imagen no llega.
Gracias de antemano!!