Llevo una semana dandole vueltas y no consigo que llegue nunca al correo, de hecho he probado con php mailer siguiendo el tutorial 37 y tampoco llega.
He cambiado de hosting y tampoco llega, he comprobado los registros de la base de datos en el hosting y estan correctos, ya que de otro modo no puedo enviar el correo(si no esta en la base de datos)
Este es el formulario.
delphi
<?php require_once("class/class.php"); if (isset($_POST["grabar"])and $_POST["grabar"]=="si") { $trabajoinstan = new Trabajo; $trabajoinstan->olvido_contraseña(); } ?> <html> <head> <META HTTP-EQUIV="Content-Type" CONTENT="text/html; charset=UTF-8"> <link type="text/css" rel="stylesheet" href="css/estilos.css"/> <script language="javascript" type="text/javascript" src="js/funciones.js"> </script> <script language="javascript" type="text/javascript" src="js/md5.js"> </script> <title>SISTEMAS DE ENCUESTAS</title> </head> <body onload="borrado();" > <center> <h1 id="tituloh1">SISTEMAS DE ENCUESTAS</h1> <fieldset id="barralogin"> <a href="registro.php" title="registro">Registrarse</a> || <a href="index.php" title="login">Login</a> </fieldset> <hr /> </center> <center> <fieldset id="fondoverde"> <legend><strong>Reestablecer mi contraseña</strong></legend> <form action="" method="POST" name="formulariox"> <table> <tr> <td id="cabecera">Email</td> <td id="cabeceradatos"><input type="text" name="correo" /></td> </tr> <div id="error"></div> <tr> <td id="cabecera"><input type="hidden" name="grabar" value="si" /></td> <td id="cabeceradatos"><input id="boton" type="button" value="INGRESAR DATOS USUARIO" onclick="olvido();"/></td> </tr> </table> </form> </fieldset> </center> </body> </html>
Este es olvido() de javascript, en el onclick abajo del formulario
delphi
function olvido() { if (document.formulariox.correo.value==0) { document.getElementById('error').innerHTML="<font color='red'><strong>El campo CORREO esta completamente vacio</strong></font>"; document.formulariox.correo.focus(); return false; }
y por ultimo olvido_contraseña() llamado al principio del formulario
delphi
public function olvido_contraseña() { $sql="select * from usuarios where correo ='".$_POST["correo"]."' "; $consulta= mysql_query($sql, Conectar::Conex()); if (mysql_num_rows($consulta)!=0) { echo "el campo correo existe y bien"; while ($reg = mysql_fetch_array($consulta)) { $nombre=$reg["nombre"]; $id_usuario=$reg["id_usuario"]; } ////////////////////////////////////envio de correo///////////////////////////////////////////////// $mi_mail=$_POST["correo"]; $remitente="Tuto 53 PHP POO<correopersonalizado@shinneo.es>"; $asunto="Tutorial 53 PHP POO"; //Asunto $cuerpo=" <html> <head> <body> <h2>Hola $nombre </h2> Para restablecer tu contraseña entra en el siguiente enlace: Atentamente el equipo de Programadores </body> </html> "; //mensaje $sheader="From:".$remitente."\nReply-To:".$remitente."\n"; $sheader=$sheader."X-Mailer:PHP/".phpversion()."\n"; $sheader=$sheader."Mime-Version: 1.0\n"; $sheader=$sheader."Content-Type: text/html"; echo $cuerpo; echo "<br />"; echo $asunto; echo "<br />"; echo $mi_mail; mail($mi_mail,$asunto,$cuerpo,$sheader); //header("Location: olvido.php?m=2"); exit; ////////////////////////////////////fin de envio de correo///////////////////////////////////////////////// } else { echo '<div id="rojo">EL CAMPO INTRODUCIDO NO EXISTE EN LA BASE DE DATOS</div>'; } }
Espero que alguien me pueda ayudar.
Gracias.