Foros del Web » Creando para Internet » HTML »

Ayuda con codigo de mail

Estas en el tema de Ayuda con codigo de mail en el foro de HTML en Foros del Web. He leido por todo el foro y sigo entramprada, tengo un enviar1.php <body> <div align="center"> <table width="100%" border="0" cellspacing="5" cellpadding="0"> <tr> <td>cabecera de pagina </td> ...
  #1 (permalink)  
Antiguo 11/04/2008, 23:00
 
Fecha de Ingreso: diciembre-2006
Mensajes: 7
Antigüedad: 17 años, 4 meses
Puntos: 0
Ayuda con codigo de mail

He leido por todo el foro y sigo entramprada,

tengo un enviar1.php
<body>
<div align="center">
<table width="100%" border="0" cellspacing="5" cellpadding="0">
<tr>
<td>cabecera de pagina </td>
</tr>
<tr>
<td align="center"><table border="0" cellspacing="0" cellpadding="0">
<tr>
<td valign="top" width="223" height="204" style="background:url("><div style=" margin-left:5px" align="center"><img src="images/7_w2.gif" alt="" width="90" height="12" /><br />
<img src="images/ba8.jpg" border="0" /><br />
<br />
<br style="line-height:22px " />
</div></td>
<td valign="top" width="247" height="204" style="background:url("><div style="padding-top:10px" >
<div align="left">
<?php
$ip = $_POST['ip'];
$httpref = $_POST['httpref']; // NO FUNCIONA, LO DEJA EN BLANCO CUANDO LLEGA EL MAIL
$httpagent = $_POST['httpagent'];
$nombre = $_POST['nombre'];
$apellido = $_POST['apellido'];
$coreovisita = $_POST['coreovisita'];
$telefono = $_POST['telefono'];
$comentario = $_POST['comentario'];
$attn = 'Formulario de Contacto- xxxxxxx';
if (eregi('http:', $comentario)) {
die ("Esta mal escrito! ! ");
}

// Validacion email SI ESTA MAL MUESTRA MENSAJE PERO NO MUESTRA EL PIE DE PAGINA
if(!$coreovisita == "" && (!strstr($coreovisita,"@") || !strstr($coreovisita,".")))
{
echo "<h1 class=verde> Ingrese un E-mail valido</h1>\n";
$badinput = "<h1 class=verde>Su comentario no fue enviado</h1>\n";
echo $badinput;
die ("<h1 class=verde>Escriba su mail en forma correcta, regrese</h1> ");
}
// valida los campos que no esten vacios. SI ESTAN VACIOS MUESTRA MENSAJE PERO NO MUESTRA PIE DE PAGINA
if(empty($nombre) || empty($coreovisita) || empty($telefono) || empty($apellido) || empty($comentario )) {
echo "<h1 class=verde> Complete todos los campos</h1>\n";
die ("<h1 class=verde>Complete los datos si desea mandarlo</h1>");
}
$todayis = date("l, F j, Y, g:i a") ;
$subject = $attn;
$comentario = stripcslashes($comentario);
$message = " $todayis [EST] \n
Mensaje: $comentario \n
From: $nombre ($coreovisita)\n
Informacion adicional : IP = $ip \n
Navegador usado: $httpagent \n
Referido de : $httpref \n
";
$from = "From: $coreovisita\r\n";
mail("[email protected]", $subject, $message, $apellido, $telefono, $from);
?>
Gracias : <?php echo $nombre ?> <?php echo $apellido ?> <br />
<br />
<br />
<br />
</div>
</div>
<br style="line-height:20px" />
<br />
<div align="center" xxxxxx se pondra en contacto a la brevedad<br />
<br />
<a href="index.php" > Volver a Inicio></a></div></td>
<td valign="top" width="242" height="204"><div style=" margin-left:17px">
<p><direccion direccion direccion direccion direccion </strong></p>
<pdireccion direccion direccion direccion direccion </strong><br />
<br />
</p>
</div></td>
</tr>
</table></td>
</tr>
<tr>
<td>pie de pagina </td>
</tr>
</table>
</div>
</body>
</html>

y tengo pruebadecontacto1.php
<html>
<head>
<meta http-equiv="content-type" content="text/html; charset=UTF-8">
</head>
<body >
<div align="center">
<table width="75%" border="0" cellspacing="5" cellpadding="0">
<tr>
<td>cabecera</td>
</tr>
<tr>
<td><table border="0" cellspacing="0" cellpadding="0">
<tr>
<td valign="top" width="223" height="204" <div style=" margin-left:5px" align="center"><img src="images/7_w2.gif" alt="" width="90" height="12"><br>
<img src="images/ba8.jpg" width="183" height="149" border="0"><br>
<br><br style="line-height:22px "> </div></td>
<td valign="top" width="247" height="204" <form method="post" action="enviar1.php">
<?php
$ipi = getenv("REMOTE_ADDR");
$httprefi = getenv ("HTTP_REFERER");
$httpagenti = getenv ("HTTP_USER_AGENT");
?>
<input type="hidden" name="ip2" value="<?php echo $ipi ?>" />
<input type="hidden" name="httpref2" value="<?php echo $httprefi ?>" />
<input type="hidden" name="httpagent2" value="<?php echo $httpagenti ?>" />
<table width="100%" border="0" cellspacing="5" cellpadding="0">
<tr>
<td width="22%">Nombre</td>
<td width="78%"><input name="nombre" type="text" id="nombre" size="30" maxlength="50">
</td>
</tr>
<tr>
<td>Apellido</td>
<td><input name="apellido" type="text" id="apellido" size="30" maxlength="50"></td>
</tr>
<tr>
<td>Teléfono</td>
<td><input name="telefono" type="text" id="telefono" size="10" maxlength="8"></td>
</tr>
<tr>
<td>E-mail</td>
<td><input name="coreovisita" type="text" id="coreovisita"size="30" maxlength="50"></td>
</tr>
<tr>
<td valign="top">Mensaje</td>
<td><textarea name="comentario" cols="0" rows="0" id="comentario" ></textarea></td>
</tr>
<tr>
<td>&nbsp;</td>
<td><input name="submit" type="submit" value="Enviar "></td>
</tr>
</table>
</form></td>
<td valign="top" width="242" height="204"><div style=" margin-left:17px ">texto texto texto texto><br>
</div></td>
</tr>
</table></td>
</tr>
<tr>
<td>pie de pagina </td>
</tr>
</table>
</div>
</body>
</html>

Alguien puede decirme * favor que esta mal, no consigo q llegue el mail y si los datos estan mal o vacios me muestra los mensajes pero no me muestra el resto de la pag., e provado todo ... Gracias (una sola vez llego el mail) pero faltaban datos, los complete y despues nunca mas llegaron
  #2 (permalink)  
Antiguo 12/04/2008, 00:38
Avatar de aloqui  
Fecha de Ingreso: diciembre-2007
Mensajes: 973
Antigüedad: 16 años, 4 meses
Puntos: 24
Re: Ayuda con codigo de mail

Los nombres de los <input> que tienes en la página de pruebadecontacto1 deben coincidir con los que luego intentas leer en el servidor y no coinciden.
Ejemplos:
Tienes un <input name="httpref2"...> que luego intentas leer con $httpref = $_POST['httpref'];
Tienes un <input name="httpagent2"...> que luego intentas leer con $httpref = $_POST['httpagent'];

Y otra cosa, te sugiero que a los <input> además de ponerle el atributo "name", le pongas tambien el atributo "id" con el mismo valor. Quizá no es necesario pero algunos navegadores lo usan.
Sería algo así: <input name="httpref2" id="httpref2" ...>
__________________
Grupos de Música
Pop Music Stars
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 04:27.