[prev in list] [next in list] [prev in thread] [next in thread]
List: php-general-es
Subject: [PHP-ES] (solucionado) [PHP-ES] primer mensaje a la lista
From: Pablo_Rodríguez <oinos () web ! de>
Date: 2005-09-29 19:36:26
Message-ID: 433C423A.3020504 () web ! de
[Download RAW message or body]
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 " /> <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
--
PHP Spanish Localization Talk Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php
[prev in list] [next in list] [prev in thread] [next in thread]
Configure |
About |
News |
Add a list |
Sponsored by KoreLogic