Ver Mensaje Individual
  #1 (permalink)  
Antiguo 18/09/2007, 03:23
xinxan22
 
Fecha de Ingreso: septiembre-2005
Mensajes: 522
Antigüedad: 18 años, 7 meses
Puntos: 0
Enviar por MAIL codigo PHP

Hola, estoy intentando enviar un email mediante la función mail, y lo hago en formato html y cuando hago servir programación php+mysql para rellenar una tabla no me deja. Tengo lo siguiente:

Código PHP:
$mensaje="
<html>
<body>
  <table>
  <tr>
  <td>VALOR 1</td>
  <td>VALOR 2</td>
  <td>VALOR 3</td>
  </tr>"
;
//Rellenar
  
......
  
$query=mysql_query("SELECT ... FROM ...;",$conectar_base_datos);
  while(
$row=mysql_fetch_row($query)){
    
$mensaje.="<tr><td>$row[0]</td><td>$row[1]</td><td>$row[2]</td></tr>";
  }
  ......
//Fin rellenar
$mensaje.="
  </table>
</body>
</html>"
;
//Lleno las cabeceras
$headers.="From: \"$nombre\" <$email>\r \n"
$headers.="X-Mailer:PHP/'.phpversion().'\n"
$headers.="Mime-Version: 1.0\n"
$headers.="Content-Type: text/html"
//Lleno el destino
$destino="[email protected]";
//Lleno el asunto
$asunto="Un mensaje";
//Envio el email
mail($destino,$asunto,$mensaje,$headers); 

Me funciona el email si lo envío sin la programación PHP, pero solo no me funciona. Alguien me pude ayudar hacerlo ?