Hola a todos.
No consigo enviar por mail los datos de un sistema de pedidos que tengo guardados en una variable de sesion. Para que me muestre estos datos utilizo una funcion a la que llamo de la siguiente forma:
$_SESSION["ocarrito"]->imprime_carrito();
Esto me lo hace perfectamente.
Pero si en el cuerpo del mail utilizo esta funcion no me la envía, es más, me muestra los datos en pantalla junto a la confirmación de que el mensaje se ha enviado correctamente.
Alguien podría decirme como solucionar esto?
Adjunto el codigo de la página que envia el mail:
envio.php
<?php
include("lib_carrito.php");
if(!$_SESSION[auth])
{
header("Location: index.php");
}
$sfrom="$email"; //cuenta que envia
$sdestinatario="[email protected]"; //cuenta destino
$ssubject="Pedido desde la página web"; //subject
$shtml="<!DOCTYPE HTML PUBLIC '-//W3C//DTD HTML 4.01 Transitional//EN'>
<html>
<head>
<title>Pedido desde la página web</title>
<style>
.txt{
font-family: arial;
font-size: 9px;
color: '#444444';
}
.tit{
font-family: arial;
font-size: 11px;
color: '#444444';
font-weight: bold;
padding-left: 5px;
padding-right: 5px;
}
</style>
<link rel='stylesheet' href='estilos.css' type='text/css'>
</head>
<body bgcolor='#E0E4EC' marginwidth='0' marginheight='0' topmargin='40' leftmargin='0'>
<table align='center' bgcolor='ffffff' width='771' border='0' cellspacing='0' cellpadding='0'>
<tr>
<td colspan='2' class='a11gr' height='80'><center><font color='#357EB5'><u>HA RECIBIDO EL SIGUIENTE PEDIDO DESDE LA PÁGINA WEB</u></font></center>
</td>
</tr>
<tr>
<td valign='top' width='40%' height='200' align='center'><img src='http://www.uvedoblestudio.com/img/cereza.jpg' width='150' height='200'>
</td>
<td valign='top' class='tit'><u>ENVÍA:</u><br><br><br><span class='txt'><b>Empresa:</b> $empresa<br><br><b>CIF:</b> $cif<br><br><b>Nombre:</b> $nombre<br><br><b>Dirección:</b> $direccion - $municipio [ $provincia ]<br><br><b>Tlfno.:</b> $telefono - <b>Fax:</b> $fax<br><br><b>E-mail:</b> $email</span><br><br><br><u>PEDIDO:</u><br><br>
</td>
</tr>
<tr>
<td valign='top' colspan='2'>"
$_SESSION["ocarrito"]->imprime_carrito();
echo"</td>
</tr>
<tr>
<td valign='top' colspan='2' height='30'>
</td>
</tr>
</table>
</body>
</html>
"; //mensaje
$sheader="From:".$sfrom."\nReply-To:".$sfrom."\n";
$sheader=$sheader."X-Mailer:PHP/".phpversion()."\n";
$sheader=$sheader."Mime-Version: 1.0\n";
$sheader=$sheader."Content-Type: text/html";
mail($sdestinatario,$ssubject,$shtml,$sheader);
if(mail)
{
echo" El mensaje se ha enviado correctamente";
session_destroy();
}
else
{
echo("Atención! Ocurrió un error, si éste persiste comuniquelo a los responsables del web. Gracias<br /><a href='home.php'>Salir</a>");
}
?>
Muchas gracias.