Foros del Web » Programando para Internet » PHP »

Problema al recibir boletin de Noticias

Estas en el tema de Problema al recibir boletin de Noticias en el foro de PHP en Foros del Web. Hola Pues estoy haciendo mi boletin de Noticias, para mi querida web www.gamebox.cl Resulta que me llega al correo, pero no me llega como HTML, ...
  #1 (permalink)  
Antiguo 10/01/2006, 22:48
 
Fecha de Ingreso: octubre-2004
Ubicación: Santiago, Chile
Mensajes: 92
Antigüedad: 19 años, 6 meses
Puntos: 0
Problema al recibir boletin de Noticias

Hola
Pues estoy haciendo mi boletin de Noticias, para mi querida web www.gamebox.cl
Resulta que me llega al correo, pero no me llega como HTML, sino que me aparece todo el código el HTML, como dios lo hecho al mundo ----

esto es lo que hice para enviar los correos:

Código PHP:
 ####################NOTICIAS
  
$result2 $db->sql_query("SELECT * FROM *** WHERE **='0'  ORDER BY time DESC LIMIT 0,5");
if (
$db->sql_numrows($result2) > 0) {
  while (
$row2 $db->sql_fetchrow($result2)) {
    
$sid intval($row2['sid']);
    
    
$informant $row2['***'];
    
$titlebig $row2['title'];
    
$textbig $row2['***'];
    
$title substr($titlebig038); 
    
$text substr($textbig0130); 
    
$comentarios$row2['***'];
    
$text2 $row2['***'];
    
$notero $row2['***'];
    
$categoria $row2['***'];
    
$ratings $row2['***'];
$mensaje "<html>";
$mensaje .= "<head>";
$mensaje .= "<title>Untitled Document</title>";
$mensaje .= "<meta http-equiv=\"Content-Type\" content=\"text/html; charset=iso-8859-1\">";
$mensaje .= "</head>";

$mensaje .= "<body>";  
$mensaje .= "<table width=\"100%\"  border=\"0\" cellspacing=\"0\" cellpadding=\"0\" height=\"118\">";
$mensaje .= "  <tr>";
$mensaje .= "    <td width=\"86%\" align=\"left\" valign=\"top\"><table width=\"100%\"  border=\"0\" cellspacing=\"0\" cellpadding=\"10\">";
$mensaje .=  "  <tr>";
$mensaje .= "<td  align=\"left\" valign=\"top\">";
$mensaje .= "<a href=\"http://www.gamebox.cl/modules.php?name=News&amp;****\" class=\"titulo_noticias\" >$title...</a><br>$text...<br><br><a href=\"http://www.gamebox.cl/modules.php?name=News&amp;file=****\" class=\"archivo_news\" >Noticia completa</a><font class=\"informante_noticias\"> |$comentarios Comentarios|</font><hr>";
$mensaje .= "</td>";
$mensaje .= "  </tr>";
$mensaje .=  "</table>";
  
  
  
$mensaje .=  "    <td width=\"14%\" align=\"center\" valign=\"top\">";
$mensaje .= "<table width=\"100%\"  border=\"0\" cellpadding=\"0\" cellspacing=\"0\">";
$mensaje .= "  <tr>";
$mensaje .=  "    <td align=\"left\" valign=\"top\"><table width=\"100%\"  border=\"0\" cellpadding=\"0\" cellspacing=\"0\">";

$mensaje .=  "    </table></td>";
$mensaje .=  "  </tr>";
$mensaje .= "  <tr>";
$mensaje .=  "    <td align=\"left\" valign=\"top\" bgcolor=\"#900000\"><table width=\"100%\"  border=\"0\" cellspacing=\"2\" cellpadding=\"2\">";
$mensaje .=  "      <tr>";
$mensaje .=  "        <td>&nbsp;</td>";
$mensaje .=  "        <td align=\"center\" valign=\"middle\"><a href=\"http://www.gamebox.cl/modules.php?name=News&amp;file=***\"><img src=\"http://www.gamebox.cl/***/$sid.jpg\" width=\"100\" height=\"75\" border=\"0\"  class=\"imagenes\"></a></td>";
$mensaje .=  "        <td></td>";
$mensaje .=  "      </tr>";
$mensaje .=  "    </table></td>";
$mensaje .=  "  </tr>";
$mensaje .=  "  <tr>";
$mensaje .= "    <td align=\"left\" valign=\"top\"><table width=\"100%\"  border=\"0\" cellpadding=\"0\" cellspacing=\"0\">";

$mensaje .=  "    </table></td>";
$mensaje .=  "  </tr>";
$mensaje .=  "</table>";
$mensaje .= "";
  
$mensaje .= "</td>";

$mensaje .=  "</table>";
$mensaje .= "";
$mensaje .= "</body>";
$mensaje .= "</html>";
  }
  }    
$admin "****@gamebox.cl"
 
####################FIN NOTICIAS    
mail($admin,"Boletin de Noticias",$mensaje); 
Eso, me imagino que debe faltar algun codigo en la función mail , o algo por el estilo,,,
espero me ayuden ,,
Un saludo
__________________
Necesito Colaboradores :arriba:
Siempre aprendiendo algo :pensando:
www.gamebox.cl
  #2 (permalink)  
Antiguo 10/01/2006, 23:27
Avatar de Seppo  
Fecha de Ingreso: marzo-2005
Ubicación: Buenos Aires, Argentina
Mensajes: 1.284
Antigüedad: 19 años, 1 mes
Puntos: 17
Te falta meter un "header" que indique q es código HTML

Código PHP:

mail
($admin,"Boletin de Noticias",$mensaje,"Content-Type: text/html; charset=utf-8\r\n"); 
Realmente te falta mucho otros header básicos, como From o Fromname...
  #3 (permalink)  
Antiguo 11/01/2006, 04:47
 
Fecha de Ingreso: octubre-2004
Ubicación: Santiago, Chile
Mensajes: 92
Antigüedad: 19 años, 6 meses
Puntos: 0
Cita:
Iniciado por Seppo
Te falta meter un "header" que indique q es código HTML

Código PHP:

mail
($admin,"Boletin de Noticias",$mensaje,"Content-Type: text/html; charset=utf-8\r\n"); 
Realmente te falta mucho otros header básicos, como From o Fromname...
pues, me ha funcionado de maravilla, el único cambio que realicé fue este:

Código PHP:
mail($admin,"Boletin de Noticias",$mensaje,"Content-Type: text/html; charset=utf-8\r\n"); 
por
Código PHP:
mail($admin,"Boletin de Noticias",$mensaje,"Content-Type: text/html; charset=iso-8859-1\r\n"); 
Ya que con ese charset=iso-8859-1 , me muestra los acentos correctamente, lo que no ocurria con charset=utf-8

Eso, ahí me funciona OK.....

Pero tengo otro drama. Si se fijan en el código, la petición que hace a la base de datos, es para que muestre los 5 resultados más recientes, sin embargo, lo único que me envía al correo es el resultado número 5 (de los 5 más recientes). Que Ocurrirá, debe haber un problema en el orden....CREO!!!!!

Ojalá alguien me pueda ayudar....

Saludos
__________________
Necesito Colaboradores :arriba:
Siempre aprendiendo algo :pensando:
www.gamebox.cl
  #4 (permalink)  
Antiguo 11/01/2006, 05:06
Avatar de Seppo  
Fecha de Ingreso: marzo-2005
Ubicación: Buenos Aires, Argentina
Mensajes: 1.284
Antigüedad: 19 años, 1 mes
Puntos: 17
El problema es q lo vas pisando con la línea, es decir, que elimina lo anterior
Código PHP:
$mensaje "<html>"
Solución
Código PHP:
  $result2 $db->sql_query("SELECT * FROM *** WHERE **='0'  ORDER BY time DESC LIMIT 0,5");
if (
$db->sql_numrows($result2) > 0) {
$mensaje "<html>";
$mensaje .= "<head>";
$mensaje .= "<title>Untitled Document</title>";
$mensaje .= "<meta http-equiv=\"Content-Type\" content=\"text/html; charset=iso-8859-1\">";
$mensaje .= "</head>";

$mensaje .= "<body>";  
$mensaje .= "<table width=\"100%\"  border=\"0\" cellspacing=\"0\" cellpadding=\"0\" height=\"118\">";
  while (
$row2 $db->sql_fetchrow($result2)) {
    
$sid intval($row2['sid']);
    
    
$informant $row2['***'];
    
$titlebig $row2['title'];
    
$textbig $row2['***'];
    
$title substr($titlebig038); 
    
$text substr($textbig0130); 
    
$comentarios$row2['***'];
    
$text2 $row2['***'];
    
$notero $row2['***'];
    
$categoria $row2['***'];
    
$ratings $row2['***'];
$mensaje .= "  <tr>";
$mensaje .= "    <td width=\"86%\" align=\"left\" valign=\"top\"><table width=\"100%\"  border=\"0\" cellspacing=\"0\" cellpadding=\"10\">";
$mensaje .=  "  <tr>";
$mensaje .= "<td  align=\"left\" valign=\"top\">";
$mensaje .= "<a href=\"http://www.gamebox.cl/modules.php?name=News&amp;****\" class=\"titulo_noticias\" >$title...</a><br>$text...<br><br><a href=\"http://www.gamebox.cl/modules.php?name=News&amp;file=****\" class=\"archivo_news\" >Noticia completa</a><font class=\"informante_noticias\"> |$comentarios Comentarios|</font><hr>";
$mensaje .= "</td>";
$mensaje .= "  </tr>";
$mensaje .=  "</table>";
  
  
  
$mensaje .=  "    <td width=\"14%\" align=\"center\" valign=\"top\">";
$mensaje .= "<table width=\"100%\"  border=\"0\" cellpadding=\"0\" cellspacing=\"0\">";
$mensaje .= "  <tr>";
$mensaje .=  "    <td align=\"left\" valign=\"top\"><table width=\"100%\"  border=\"0\" cellpadding=\"0\" cellspacing=\"0\">";

$mensaje .=  "    </table></td>";
$mensaje .=  "  </tr>";
$mensaje .= "  <tr>";
$mensaje .=  "    <td align=\"left\" valign=\"top\" bgcolor=\"#900000\"><table width=\"100%\"  border=\"0\" cellspacing=\"2\" cellpadding=\"2\">";
$mensaje .=  "      <tr>";
$mensaje .=  "        <td>&nbsp;</td>";
$mensaje .=  "        <td align=\"center\" valign=\"middle\"><a href=\"http://www.gamebox.cl/modules.php?name=News&amp;file=***\"><img src=\"http://www.gamebox.cl/***/$sid.jpg\" width=\"100\" height=\"75\" border=\"0\"  class=\"imagenes\"></a></td>";
$mensaje .=  "        <td></td>";
$mensaje .=  "      </tr>";
$mensaje .=  "    </table></td>";
$mensaje .=  "  </tr>";
$mensaje .=  "  <tr>";
$mensaje .= "    <td align=\"left\" valign=\"top\"><table width=\"100%\"  border=\"0\" cellpadding=\"0\" cellspacing=\"0\">";

$mensaje .=  "    </table></td>";
$mensaje .=  "  </tr>";
$mensaje .=  "</table>";
$mensaje .= "";
  
$mensaje .= "</td></tr>"//me parece q faltaba un </tr>

  
}
$mensaje .=  "</table>";
$mensaje .= "";
$mensaje .= "</body>";
$mensaje .= "</html>";
  }    
$admin "****@gamebox.cl"
 
####################FIN NOTICIAS    
mail($admin,"Boletin de Noticias",$mensaje,"Content-Type: text/html; charset=iso-8859-1\r\n"); 
  #5 (permalink)  
Antiguo 11/01/2006, 05:15
 
Fecha de Ingreso: octubre-2004
Ubicación: Santiago, Chile
Mensajes: 92
Antigüedad: 19 años, 6 meses
Puntos: 0
Pues, era eso, hice el cambio, y me envio los 5 resultados. Gracias Maestro!!!!

Una última cosa,
Cuando me llegá el mensaje me dice
"
De: granuncabox@nombre_de_servidor_de_correo.com (granuncabox)
A: ******
Cc:
Asunto: gAMEbOX.cl , Boletín Semanal de Videojuegos
Enviado: Wed, 11 Jan 2006 03:12:06 -0800
"
Existe alguna forma, para que en De: me aparezca una dirección o alguna palabra que yo defina, y no ese largo nombre del servidor de correo del hosting?

Un saludo
__________________
Necesito Colaboradores :arriba:
Siempre aprendiendo algo :pensando:
www.gamebox.cl
  #6 (permalink)  
Antiguo 11/01/2006, 05:20
Avatar de Seppo  
Fecha de Ingreso: marzo-2005
Ubicación: Buenos Aires, Argentina
Mensajes: 1.284
Antigüedad: 19 años, 1 mes
Puntos: 17
Esas son cabeceras q te dije q faltaban =P

Código PHP:
mail($admin,"Boletin de Noticias",$mensaje,"Content-Type: text/html; charset=iso-8859-1\r\nFrom: Nombre<[email protected]>\r\n"); 
  #7 (permalink)  
Antiguo 11/01/2006, 05:38
 
Fecha de Ingreso: octubre-2004
Ubicación: Santiago, Chile
Mensajes: 92
Antigüedad: 19 años, 6 meses
Puntos: 0
Cita:
Iniciado por Seppo
Esas son cabeceras q te dije q faltaban =P

Código PHP:
mail($admin,"Boletin de Noticias",$mensaje,"Content-Type: text/html; charset=iso-8859-1\r\nFrom: Nombre<[email protected]>\r\n"); 
Gracias, amigo, te has pasado en tu ayuda,,,voy a confecccionar un excelente boletin de noticias, gracias Maestro!!!

A todo esto, que te parece mi sitio?

www.gamebox.cl

Saludos
__________________
Necesito Colaboradores :arriba:
Siempre aprendiendo algo :pensando:
www.gamebox.cl
  #8 (permalink)  
Antiguo 11/01/2006, 22:20
 
Fecha de Ingreso: octubre-2004
Ubicación: Santiago, Chile
Mensajes: 92
Antigüedad: 19 años, 6 meses
Puntos: 0
Pasa algo raro,,,
Me funciona super bien el boletin, eso sí,,,me pasa solo al ver el correo en la web, en mi cuenta de yahoo....
Ocurre que no me aplica ( o no me toma) el CSStyles, no se porqué,,ya que si ese mismo correo de la cuenta de yahoo, lo abro con el outlook express, me lo toma de inmediato, y super bien. Tambien me lo toma bien, en otros webmails...
que podrá estar pasando???
__________________
Necesito Colaboradores :arriba:
Siempre aprendiendo algo :pensando:
www.gamebox.cl
  #9 (permalink)  
Antiguo 11/01/2006, 22:59
Avatar de Panino5001
Me alejo de Omelas
 
Fecha de Ingreso: mayo-2004
Ubicación: -34.637167,-58.462984
Mensajes: 5.148
Antigüedad: 19 años, 10 meses
Puntos: 834
Verificá 2 cosas:
1) haber puesto la ruta absoluta (http://etc,etc) a tu hoja de estilos
2)-esta me volvió loco alguna vez- que tus líneas en el html generado no sean demasiado largas, porque yahoo te corta las líneas html e inserta un separador que hace que tu html no se vea como querés: ej: a una imagen llamada algo.jpg le puede pasar esto: <img src="algo.j_elseparadordeyahooquenorecuerdocómoera _pg">
Saludos
Atención: Estás leyendo un tema que no tiene actividad desde hace más de 6 MESES, te recomendamos abrir un Nuevo tema en lugar de responder al actual.
Respuesta




La zona horaria es GMT -6. Ahora son las 18:59.