(solucionado) [PHP-ES] primer mensaje a la lista

From: Date: Thu, 29 Sep 2005 19:36:26 +0000
Subject: (solucionado) [PHP-ES] primer mensaje a la lista
References: 1 2 3 4 5 6 7 8  Groups: php.general.es 
Request: Send a blank email to general-es+get-56006@lists.php.net to get a copy of this message
Llevo todo el día de hoy (más de doce horas) intentando solucionar el envío de correo a través de un formulario PHP. Mañana colgaré la página y mis resultados son los que os enseño. El html es: <form action="contct.php" method="post" name="envio" id="envio"> <input type="hidden" name="redirect" value="contacto_enviado.htm" /> <input type="hidden" name="subject" value="Formulario de contacto" /> <div class="txtpg" style="width:57%; left:20%;"> <table style="font-weight:bold;color:#ffffff;"> <tr> <td>Nombre</td> <td><input name="Nombre" type="text"></td> </tr> <tr> <td>Apellidos</td> <td><input name="Apellidos" type="text"></td> </tr> <tr> <td>Empresa</td> <td><input name="Empresa" type="text"></td> </tr> <tr> <td>Dirección</td> <td><input name="Dirección" type="text"></td> </tr> <tr> <td>Ciudad</td> <td><input name="Ciudad" type="text"></td> </tr> <tr> <td>Provincia</td> <td><input name="Provincia" type="text"></td> </tr> <tr> <td>Código postal:</td> <td><input name="Código postal" type="text"></td> </tr> <tr> <td>Teléfono:</td> <td><input name="Teléfono" type="text"></td> </tr> <tr> <td>Correo electrónico:</td> <td><input name="Correo-e" type="text"></td> </tr> <tr> <td>Comentarios:</td> <td><textarea name="Comentarios" cols="25" rows="10"></textarea></td> </tr> </table> <p style="text-align:center;"><input name="Submit" type="submit" value=" Enviar " />&nbsp;&nbsp;&nbsp;&nbsp;<input name="Submit2" type="reset" value=" Borrar " /></p> </div> </form> Y el PHP es: <? $recipient = "usuario@dominio.com"; $from = $_POST["Correo-e"]; foreach($_POST as $indice => $valor) if(($indice<>"Submit") and ($indice<>"recipient") and ($indice<>"redirect") and ($indice<>"subject")) $message.= $indice.": ".$valor."\n"; $coment = $_POST["Comentarios"]; $messag = $coment."\n\n\n".$message; $headers = "Content-Type: text/plain; charset=\"utf-8\"\n Content-Transfer-Encoding: quoted-printable\n Content-Disposition: inline\n"; $headers.= "From: ".$from."\r\n"; mail($recipient, $subject, $messag, $headers); echo "<script>parent.location='".$redirect."'</script>"; ?> Creo que lo interesante de este script es que permite que el mensaje lo envíen en Unicode, que es el mayor problema que tenía. Muchas gracias por vuestra ayuda y la verdad es que la experiencia ha sido gratificante. Me meteré en más PHP. Saludos, Pablo

« previous php.general.es (#56006) next »