Ver Mensaje Individual
  #6 (permalink)  
Antiguo 03/03/2008, 09:02
Avatar de GatorV
GatorV
$this->role('moderador');
 
Fecha de Ingreso: mayo-2006
Ubicación: /home/ams/
Mensajes: 38.567
Antigüedad: 18 años, 9 meses
Puntos: 2135
Re: Email para recuperacion de contraseña no llega

El problema es que no estas poniendo algun condicional para limitar que no se envie el mail si el usuario no ha presionado, prueba esto:
Código PHP:




<form action="recuperar.php" method="post" name="formrec" id="formrec">
          <table width="80%" border="0" cellspacing="0" cellpadding="0">
            <tr>
              <td></td>
            </tr>
          </table>
          <table width="59%" border="0" cellspacing="0" cellpadding="0">
            <tr>
              <td height="81" colspan="2"><div align="center"><span class="Estilo18"></span></div></td>
              </tr>
            <tr>
              <td height="81" colspan="2"><div align="center" class="Estilo17">recuperar contraseña</div></td>
              </tr>
            <tr>
              <td width="43%" height="31" bgcolor="#CCCCCC">Usuario (max 20):</td>
              <td width="49%" bgcolor="#CCCCCC"><input type="text" name="username" size="20" maxlength="20" /></td>
              </tr>
            <tr>
              <td height="29" bgcolor="#CCCCCC">&nbsp;</td>
              <td bgcolor="#CCCCCC">&nbsp;</td>
            </tr>
            <tr>
              <td height="29" bgcolor="#CCCCCC">&nbsp;</td>
              <td bgcolor="#CCCCCC">&nbsp;</td>
            </tr>
            <tr>
              <td height="29" bgcolor="#CCCCCC">&nbsp;</td>
              <td bgcolor="#CCCCCC">&nbsp;</td>
            </tr>
            <tr>
              <td height="40" colspan="2"><div align="center">
                <input type="submit" name="submit" value="recuperar" />
              </div></td>
              </tr>
          </table>
          </form>            
<?php 
if( !empty( $_POST['submit'] ) ) {
$conexion mysql_connect('localhost','user','9999')or die ('Ha fallado la conexión: '.mysql_error());
        
mysql_select_db('registro')or die ('Error al seleccionar la Base de Datos: '.mysql_error());





         
         
$query   "SELECT * FROM usuarios WHERE usuario='$username'";
         
$result mysql_query($query $conexion) or die ( mysql_error() );
         
$row   mysql_fetch_array($result);
    
          
     
          
// Datos del email

$nombre_origen    "Tuboolar Web";
$email_origen     "[email protected]";
$email_copia      "[email protected]";
$email_ocultos    "[email protected]";
//$email_destino    = "".$row['email'].""; 
$email_destino    "[email protected]";


$asunto           "".$row['usuario']." recuperar clave";

$mensaje          '<table width="629" border="0" cellspacing="1" cellpadding="2">
  <tr>
    <td width="623" align="left"></td>
  </tr>
  <tr>
    <td bgcolor="#2EA354"><div style="color:#FFFFFF; font-size:14; font-family: Arial, Helvetica, sans-serif; text-transform: capitalize; font-weight: bold;"><strong>   '
.$row['usuario'].'  su clave a sido recuperada</strong></div></td>
  </tr>
  <tr>
    <td height="95" align="left" valign="top"><div style=" color:#000000; font-family:Arial, Helvetica, sans-serif; font-size:12px; margin-bottom:3px;"> '
.$row['usuario'].'</strong>, usted ordeno recuperar su clave..<br>
          <strong>Su Clave es : </strong>'
.$row['password'].'<br>
    </div>
    </td>
  </tr>
</table>'
;



$formato          "html";

//*****************************************************************//
$headers  "From: $nombre_origen <$email_origen> \r\n";
$headers .= "Return-Path: <$email_origen> \r\n";
$headers .= "Reply-To: $email_origen \r\n";
$headers .= "Cc: $email_copia \r\n";
$headers .= "Bcc: $email_ocultos \r\n";
$headers .= "X-Sender: $email_origen \r\n";
$headers .= "X-Mailer: [naptel venezuela : emailer] \r\n";
$headers .= "X-Priority: 3 \r\n";
$headers .= "MIME-Version: 1.0 \r\n";
$headers .= "Content-Transfer-Encoding: 7bit \r\n";
$headers .= "Disposition-Notification-To: \"$nombre_origen\" <$email_origen> \r\n";
//*****************************************************************//
 
if($formato == "html")
 { 
$headers .= "Content-Type: text/html; charset=iso-8859-1 \r\n";  }
   else
    { 
$headers .= "Content-Type: text/plain; charset=iso-8859-1 \r\n";  }

if (@
mail($email_destino$asunto$mensaje$headers)) 
    { echo 
"Le hemos enviado un correo electronico con su clave ";  } 
     else 
    {  echo 
"Error "; }

        
    
     
     
     
}        
        
?></td>
        </tr>
      </table>
Saludos.