Formulario
Código:
<html> <head> <meta http-equiv="Content-Type" content="text/html; charset=utf-8" /> <title>Formulario</title> </head> <body> <form method="post" action="enviar.php"> <!-- No cambiar estas variables! --> <?php $ipi = getenv("REMOTE_ADDR"); $httprefi = getenv ("HTTP_REFERER"); $httpagenti = getenv ("HTTP_USER_AGENT"); ?> <input type="hidden" name="ip" value="<?php echo $ipi ?>" /> <input type="hidden" name="httpref" value="<?php echo $httprefi ?>" /> <input type="hidden" name="httpagent" value="<?php echo $httpagenti ?>" /> Nombres: <br /> <input type="text" name="visitor" size="35" /> <br /> E-mail:<br /> <input type="text" name="visitormail" size="35" /> <br /> <br /> Departamento:<br /> <select name="attn" size="1"> <option value=" Iphone ">Iphone</option> <option value=" Foro ">Foro</option> <option value=" Tutoriales ">Tutoriales</option> <option value=" Webmaster ">Webmaster </option> </select> <br /><br /> Mensaje: <br /> <textarea name="notes" rows="4" cols="40"></textarea> <br /> <input type="submit" value="Enviar Formulario" /> <br /> </form> </body> </html>
enviar.php
Código:
Para que el formulario llegue a mi correo me dicen en hostalia que tengo que poner en off el safe_mode del servidor php lo cual ya e echo otra cosa que me piden es que especifique un from valido con la funcion -f esto no me queda muy claro como hacerlo. lo e intentado hacer con ayuda de este manual http://www.soporte.hostalia.com/article.php?id=186.<html> <head> <meta http-equiv="Content-Type" content="text/html; charset=utf-8" /> <title>Formulario de envio Script</title> </head> <body> <!-- Recuerde: Agregue un link en donde dice 'Index' (en el boton) --> <!-- Recuerde: Cambie donde dice 'TuEmail' al email tuyo --> <?php $ip = $_POST['ip']; $httpref = $_POST['httpref']; $httpagent = $_POST['httpagent']; $visitor = $_POST['visitor']; $visitormail = $_POST['visitormail']; $notes = $_POST['notes']; $attn = $_POST['attn']; if (eregi('http:', $notes)) { die ("Do NOT try that! ! "); } // Punto 1, Valida email if(!$visitormail == "" && (!strstr($visitormail,"@") || !strstr($visitormail,"."))) { echo "<h2>Regrese - Ingrese un E-mail valido</h2>\n"; $badinput = "<h2>Su comentario no fue enviado</h2>\n"; echo $badinput; die ("Regrese a completar los datos! ! "); } // Punto 2, Valida el nombre, email y mensaje, los campos no tienen que estar vacios. if(empty($visitor) || empty($visitormail) || empty($notes )) { echo "<h2>Regrese - Rellene todos los campos</h2>\n"; die ("Regrese a completar los datos! ! "); } $todayis = date("l, F j, Y, g:i a") ; $attn = $attn ; $subject = $attn; $notes = stripcslashes($notes); $message = " $todayis [EST] \n Atencion: $attn \n Mensaje: $notes \n From: $visitor ($visitormail)\n Informacion adicional : IP = $ip \n Navegador usado: $httpagent \n Referido de : $httpref \n "; $from = "From: $visitormail\r\n"; mail("[email protected]", $subject, $message, $from); // Punto 3 cambiar por tu email. ?> // Punto 4 imprime los datos introducidos <p align="center"> Fecha: <?php echo $todayis ?> <br /> Gracias : <?php echo $visitor ?> ( <?php echo $visitormail ?> ) <br /> Atencion: <?php echo $attn ?> <br /> Mensaje:<br /> <?php $notesout = str_replace("\r", "<br/>", $notes); echo $notesout; ?> <br /> <?php echo $ip ?> <br /><br /> <a href="index.php"> Index </a> </p> </body> </html>
Aun asi el formulario sigue sin llegar a mi cuenta de correo hostalia ya no se que mas hacer alguien me puede echar una mano para configurar la funcion -f en enviar.php.