Index.php:
Código HTML:
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
<title>Documento sin título</title>
<style type="text/css">
<!--
body {
background-image: url();
}
-->
</style>
</head>
<body>
<form id="form1" name="form1" method="post" action="pagina_mail.php">
<p>Nombre </p>
<label>
<input type="text" name="textfield" />
</label>
<p>Nombre de la web</p>
<p>
<label>
<input type="text" name="textfield2" />
</label>
</p>
<p>Email</p>
<p>
<label>
<input type="text" name="textfield3" />
</label>
</p>
<p>Sugerencias para el logo (Ej. Color, color de fondo, texto, slogan, etc.)</p>
<p>
<label>
<textarea name="textarea" cols="50" rows="6"></textarea>
</label>
</p>
<p>
<label>
<input type="checkbox" name="checkbox" value="checkbox" />
</label>
Estoy de acuerdo con recibir informacion de este sitio.
</p>
<p>
<label>
<input name="submit" type="reset" id="submit" value="Restablecer" />
</label>
<label>
<input name="Submit2" type="submit" value="Enviar" />
</label>
</p>
</form>
</body>
</html>
pagina_mail.php:
Código PHP:
<?php
function form_mail($sPara, $sAsunto, $sTexto, $sDe){
if ($sDe)$sDe = "From:".$sDe;
foreach ($_POST as $nombre => $valor)
$sTexto = $sTexto."n".$nombre." = ".$valor;
return(mail($sPara, $sAsunto, $sTexto, $sDe));
}
//Ejemplo de como usar:
if (form_mail("[email protected]",
"Activación de formulario",
"Los datos introducidos en el formulario son:nn",
"[email protected]"
)
)
echo "Su formulario ha sido enviado con exito";
?>
No se si a mi host le hace algo, pero en el no envia el email.
Esto funciona? envia el email?