Ver Mensaje Individual
  #3 (permalink)  
Antiguo 10/05/2007, 20:11
guido182
 
Fecha de Ingreso: mayo-2007
Mensajes: 7
Antigüedad: 17 años
Puntos: 0
Re: Ayuda con php.mail() en html

Hola. Gracias por tu pronta respuesta. Te cuento que '$msj' esta definida como $_POST de un formulario donde esta armado todo el newsletter.
Voy a explicar bien como funciona porque me re-lei y es re confuso lo que puse jajaja.

index.php -> la persona elije que plantilla utiliza y es redirigida a news.php

news.php -> es un form con Nombre, Asunto, E-Mail respuesta y un textarea que tiene un embed de un 'wysiwyg' armado con javascripts. Hasta ahi va 10 puntos. El CHMOD esta bien establecido para escritura tanto en carpeta como en news.php y en los htmls de la plantilla. Revise el javascript y no tiene ningun 'addslashes()' este manda el form a enviado.php

enviado.php -> realiza la funcion e imprime en pantalla quienes recibieron el correo.

con respecto a si lo abre en otros lados, probe en hotmail tambien y llega sin problemas (bah bloquea la imagen pero despues con el mismo hotmail lo activa uno, y los estilos salen tal cuál)

a mi se me ocrurria que podia a llegar a estar mas por las cabeceras, hay alguna que tenga alguna funcion similar a lo que me ocurre??

aca dejo el codigo completo de enviado.php:

Código PHP:
<?php include('../restrict.php'); ?>
<?php 
include('../config.php'); ?>
<!//your script starts here when account is valid--->
<! Insert your code here ---->
<?php
$nombre
=$_POST['nombre'];
$email=$_POST['mail'];
$asunto=$_POST['asunto'];
$msj=$_POST['msj'];

// Seleccion
mysql_select_db($database_Conn$Conn);
$resultado mysql_query("SELECT Idusuario,mailcontacto,news FROM contactos WHERE Idusuario = '$MM_Id' AND news = '1' ");
$query="SELECT * FROM contactos WHERE Idusuario = '$MM_Id' AND news = '1' ";
$result=mysql_query($query);
$num=mysql_numrows($result);
$i=0;
?>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
<SCRIPT LANGUAGE="JavaScript">
function goToURL1() { window.location = "index.php"; }
function goToURL2() { window.location = "../mainf.php"; }
</script>
<style type="text/css">
<!--
.Estilo2 {    color: #FFFFFF;
    font-family: "Trebuchet MS";
    font-size: 12px;
    font-weight: bold;
}
.Estilo4 {    color: #FFFFFF;
    font-family: "Tahoma";
    font-size: 12px;
    font-weight: bold;
}
.Estilo12 {font-family: "MS Sans Serif"; font-size: 10px; }
body {
    background-image: url(../img/back.gif);
}
.Estilo13 {
    font-family: "MS Sans Serif";
    font-size: 16px;
    font-weight: bold;
}
-->
</style>
</head>
<body>
<div align="center">
  <table width="60%" border="0" align="center" bgcolor="#0059E9">
    <tr>
      <td background="../img/bar.gif"><table width="100%" border="0">
          <tr>
            <td width="3%"><img src="../img/newsletter.gif" alt="Newsletter" width="22" height="22" /></td>
            <td width="94%" class="Estilo2"><div align="left">Newlsetter</div></td>
            <td width="3%"><div align="right"><a href="../mainf.php"><img src="../img/bar-close.gif" alt="Cerrar" width="21" height="21" border="0" /></a></div></td>
          </tr>
        </table>
    <tr> </tr>
    <tr>
      <td bgcolor="#ECE9D8"><span class="Estilo12">
        <label></label>
        </span>
        <table width="100%" border="0">
          <tr>
            <td width="5%"><div align="left"></div></td>
            <td width="95%"><div align="left"><span class="Estilo13">Resultado de envio:</span></div></td>
          </tr>
          <tr>
            <td colspan="2" span class="Estilo12"><?php 
if (!$resultado) {
echo (
"
<p> Error en envio de newsletter: " 
mysql_error() . ".<br /><br />Tome nota de este error y comuniqueselo a su administrador.</p>
"
);
exit();
}
echo 
"Los siguientes contactos han recibido su newsletter: <br />";

while (
$i $num
         {
        
$sendmailnombre=$nombre;
        
$sendmailremitente=$email;
        
$sendmailasunto=$asunto;
        
$cabecera "MIME-version: 1.0\n";
        
$cabecera .= "From: $sendmailnombre<$sendmailremitente>\n";
        
$cabecera .= "Return-Path: $sendmailremitente\n";
        
$cabecera .= "Content-type: multipart/related; ";
        
$cabecera .= "boundary=\"Message-Boundary\"\n";
        
$cabecera .= "Content-transfer-encoding: 8BIT\n";
        
$mensaje "\n\n--Message-Boundary\n";
        
$mensaje .= "Content-type: text/html\n";
        
$mensaje .= "Content-transfer-encoding: 8BIT\n";
        
$mensaje .= "Content-description: Mail message body\n\n";
        
$mensaje .=$msj;
        
$dest mysql_result($resultado,$i,'mailcontacto');
        
mail($dest,$sendmailasunto,$mensaje,$cabecera);
        echo 
"<b>$dest, </b>";
          
$i++;
          };
?>
              <br />
              <br />
              <br />
              <div align="center">
                <input name="button" type="button" onclick="goToURL1()" value="  Enviar otra newsletter  " />
                &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
                <input name="button" type="button" onclick="goToURL2()" value="  Volver " />
              </div></td>
        </table></td>
    </tr>
  </table>
</div>
</body>
</html>