Hize un formulario pero al probrarlo no me envia los emnsajes. A que puede deberser? Gracias
FORMULARIO.HTML
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<html>
<head>
<title>Page title</title>
</head>
<body>
<table width="99%" border="0px" cellpadding="0px" cellspacing="0px">
<FORM action="envio.php" method="get">
<tr>
<td class="contacto1">Nombre y apellidos:*</td>
<td class="contacto"><input name="nombre" type="text " size="32"></td>
</tr>
<tr>
<td class="contacto1">Población*:</td>
<td class="contacto"><INPUT TYPE="text" NAME="poblacion"SIZE="32"></td>
</tr>
<tr>
<td class="contacto1">Profesión:</td>
<td class="contacto"><INPUT TYPE="text" NAME="profesion" SIZE="32"></td>
</tr>
<tr>
<td class="contacto1">Teléfono fijo:</td>
<td class="contacto"><INPUT NAME="telefonof" TYPE="text" SIZE="12" MAXLENGTH="12"></td>
</tr>
<tr>
<td class="contacto1">Teléfono móvil: *</td>
<td class="contacto">
<INPUT TYPE="text" NAME="telefonomovil" SIZE="12" MAXLENGTH="12"></td>
</tr>
<tr>
<td class="contacto1">e-mail: *</td>
<td class="contacto"><INPUT TYPE="text" NAME="email" SIZE="32"></td>
</tr>
<tr>
<td class="contacto1">Realice su consulta: *</td>
<td class="contacto"><TEXTAREA NAME="texto" ROWS="5"COLS="25"></TEXTAREA></td>
</tr>
<tr>
<td class="contacto1"><INPUT TYPE="submit" VALUE= "Enviar "></td>
<td class="contacto">* Campos obligatorios</td>
</tr>
</FORM>
</table>
</body>
</html>
envio.php
<?
/* aqui se incializan variables de PHP */
if (phpversion() >= "4.2.0") {
if ( ini_get('register_globals') != 1 ) {
$supers = array('_REQUEST',
'_ENV',
'_SERVER',
'_POST',
'_GET',
'_COOKIE',
'_SESSION',
'_FILES',
'_GLOBALS' );
foreach( $supers as $__s) {
if ( (isset($$__s) == true) && (is_array( $$__s
) == true) ) extract( $$__s, EXTR_OVERWRITE );
}
unset($supers);
}
} else {
if ( ini_get('register_globals') != 1 ) {
$supers = array('HTTP_POST_VARS',
'HTTP_GET_VARS',
'HTTP_COOKIE_VARS',
'GLOBALS',
'HTTP_SESSION_VARS',
'HTTP_SERVER_VARS',
'HTTP_ENV_VARS'
);
$_GET['nombre']=$nombre;
$_GET['edad']=$edad;
foreach( $supers as $__s) {
if ( (isset($$__s) == true) && (is_array( $$__s
) == true) ) extract( $$__s, EXTR_OVERWRITE );
}
unset($supers);
}
}
/* ------------------------------------------------------------------ */
/* DE AQUI EN ADELANTE PUEDES EDITAR EL ARCHIVO */
/* ------------------------------------------------------------------ */
/* define cual va a ser la hoja que se abrirá en caso de error*/
$login_page = "error.html";
/* reclama que estén rellenos los campos obligatorios del formulario */
if($email=="")
{include($login_page);
exit();
}
if($nombre=="")
{include($login_page);
exit();
}
if($poblacion=="")
{include($login_page);
exit();
}
if($texto=="")
{include($login_page);
exit();
}
/* ------------------------------------------------------------------ */
/* aquí se especifica la pagina de respuesta en caso de envío exitoso */
$respuesta="correcto.html";
/* AQUÍ ESPECIFICAS EL CORREO AL CUAL SE ENVÍAN LOS DATOS */
$para ="[correo eliminado] ";
/* AQUI ESPECIFICAS EL SUJETO DEL EMAIL */
$sujeto = "Formulario de informacion";
/* aquí se construye el encabezado del correo*/
$encabezado = "From: $nombre <$email>";
$encabezado .= "\nReply-To: $email";
$encabezado .= "\nX-Mailer: PHP/" . phpversion();
/* con esto se captura la IP del que envío el mensaje */
$ip=$REMOTE_ADDR;
/* las siguientes líneas arman el mensaje */
$mensaje .= "Nombre = $nombre\n";
$mensaje .= "Empresa = $empresa\n";
$mensaje .= "Poblacion = $poblacion";
$mensaje .= "Profesion= $profesion\n";
$mensaje .= "Telefono fijo = $telefonof\n";
$mensaje .= "Telefono movil = $telefonomovil\n";
$mensaje .= "email = $email\n";
$mensaje .= "Comentario = $texto\n";
$mensaje .= "SU DIRECCION IP = $ip\n";
/* aqui se intenta enviar el correo, si no se
tiene éxito se da un mensaje de error */
if(!mail($para, $sujeto, $mensaje, $encabezado))
{
echo "<h1>No se pudo enviar el Mensaje</h1>";
exit();
}
else
{
/* aqui redireccionamos a la pagina de respuesta */
echo "<meta HTTP-EQUIV='refresh' content='1;url=$respuesta'>";
}
?>
http://misclasesparticulares.iespana.es/
FORMULARIO.HTML
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<html>
<head>
<title>Page title</title>
</head>
<body>
<table width="99%" border="0px" cellpadding="0px" cellspacing="0px">
<FORM action="envio.php" method="get">
<tr>
<td class="contacto1">Nombre y apellidos:*</td>
<td class="contacto"><input name="nombre" type="text " size="32"></td>
</tr>
<tr>
<td class="contacto1">Población*:</td>
<td class="contacto"><INPUT TYPE="text" NAME="poblacion"SIZE="32"></td>
</tr>
<tr>
<td class="contacto1">Profesión:</td>
<td class="contacto"><INPUT TYPE="text" NAME="profesion" SIZE="32"></td>
</tr>
<tr>
<td class="contacto1">Teléfono fijo:</td>
<td class="contacto"><INPUT NAME="telefonof" TYPE="text" SIZE="12" MAXLENGTH="12"></td>
</tr>
<tr>
<td class="contacto1">Teléfono móvil: *</td>
<td class="contacto">
<INPUT TYPE="text" NAME="telefonomovil" SIZE="12" MAXLENGTH="12"></td>
</tr>
<tr>
<td class="contacto1">e-mail: *</td>
<td class="contacto"><INPUT TYPE="text" NAME="email" SIZE="32"></td>
</tr>
<tr>
<td class="contacto1">Realice su consulta: *</td>
<td class="contacto"><TEXTAREA NAME="texto" ROWS="5"COLS="25"></TEXTAREA></td>
</tr>
<tr>
<td class="contacto1"><INPUT TYPE="submit" VALUE= "Enviar "></td>
<td class="contacto">* Campos obligatorios</td>
</tr>
</FORM>
</table>
</body>
</html>
envio.php
<?
/* aqui se incializan variables de PHP */
if (phpversion() >= "4.2.0") {
if ( ini_get('register_globals') != 1 ) {
$supers = array('_REQUEST',
'_ENV',
'_SERVER',
'_POST',
'_GET',
'_COOKIE',
'_SESSION',
'_FILES',
'_GLOBALS' );
foreach( $supers as $__s) {
if ( (isset($$__s) == true) && (is_array( $$__s
) == true) ) extract( $$__s, EXTR_OVERWRITE );
}
unset($supers);
}
} else {
if ( ini_get('register_globals') != 1 ) {
$supers = array('HTTP_POST_VARS',
'HTTP_GET_VARS',
'HTTP_COOKIE_VARS',
'GLOBALS',
'HTTP_SESSION_VARS',
'HTTP_SERVER_VARS',
'HTTP_ENV_VARS'
);
$_GET['nombre']=$nombre;
$_GET['edad']=$edad;
foreach( $supers as $__s) {
if ( (isset($$__s) == true) && (is_array( $$__s
) == true) ) extract( $$__s, EXTR_OVERWRITE );
}
unset($supers);
}
}
/* ------------------------------------------------------------------ */
/* DE AQUI EN ADELANTE PUEDES EDITAR EL ARCHIVO */
/* ------------------------------------------------------------------ */
/* define cual va a ser la hoja que se abrirá en caso de error*/
$login_page = "error.html";
/* reclama que estén rellenos los campos obligatorios del formulario */
if($email=="")
{include($login_page);
exit();
}
if($nombre=="")
{include($login_page);
exit();
}
if($poblacion=="")
{include($login_page);
exit();
}
if($texto=="")
{include($login_page);
exit();
}
/* ------------------------------------------------------------------ */
/* aquí se especifica la pagina de respuesta en caso de envío exitoso */
$respuesta="correcto.html";
/* AQUÍ ESPECIFICAS EL CORREO AL CUAL SE ENVÍAN LOS DATOS */
$para ="[correo eliminado] ";
/* AQUI ESPECIFICAS EL SUJETO DEL EMAIL */
$sujeto = "Formulario de informacion";
/* aquí se construye el encabezado del correo*/
$encabezado = "From: $nombre <$email>";
$encabezado .= "\nReply-To: $email";
$encabezado .= "\nX-Mailer: PHP/" . phpversion();
/* con esto se captura la IP del que envío el mensaje */
$ip=$REMOTE_ADDR;
/* las siguientes líneas arman el mensaje */
$mensaje .= "Nombre = $nombre\n";
$mensaje .= "Empresa = $empresa\n";
$mensaje .= "Poblacion = $poblacion";
$mensaje .= "Profesion= $profesion\n";
$mensaje .= "Telefono fijo = $telefonof\n";
$mensaje .= "Telefono movil = $telefonomovil\n";
$mensaje .= "email = $email\n";
$mensaje .= "Comentario = $texto\n";
$mensaje .= "SU DIRECCION IP = $ip\n";
/* aqui se intenta enviar el correo, si no se
tiene éxito se da un mensaje de error */
if(!mail($para, $sujeto, $mensaje, $encabezado))
{
echo "<h1>No se pudo enviar el Mensaje</h1>";
exit();
}
else
{
/* aqui redireccionamos a la pagina de respuesta */
echo "<meta HTTP-EQUIV='refresh' content='1;url=$respuesta'>";
}
?>
http://misclasesparticulares.iespana.es/