Ver Mensaje Individual
  #4 (permalink)  
Antiguo 20/10/2010, 14:18
Avatar de saraivaruas
saraivaruas
 
Fecha de Ingreso: octubre-2010
Ubicación: Chile
Mensajes: 133
Antigüedad: 13 años, 6 meses
Puntos: 10
Respuesta: Para que un email sea verdadero y no falso

Cita:
Iniciado por zapt142 Ver Mensaje
1.-Puedes validar la estructura de un correo mediante, javascript, php o expresiones regulares
2.-Podrias generar un codigo con php el cual lo podrias insertas en la bd y luego enviarselo al usuario al momento de que se registre y cuando quiera acceder al sitio pues le pides el codigo

espero haberte ayudado

Hola Zapt!

Este e es mi codigo pero algo estoy haciendo mal miralo:

Código PHP:
<?php 

if (!$HTTP_POST_VARS){ 
echo 
"<html><body> 
<form action=p2.php method=POST> 
 <input type=text name=mail> 
 <input type=submit name=boton value=Aceptar> 
 </form> 
</html>"


else { 
 
ValidateMail ($mail); 
 

        function 
ValidateMail($Email) { 
            global 
$HTTP_HOST
    
$result ValidateMail($correo); 
   
if (!
eregi("^[_a-z0-9-]+(\.[_a-z0-9-]+)*@[a-z0-9-]+(\.[a-z0-9-]+)*(\.[a-z]{2,3})$"$Email)) { 

  
$result[0]=false
        
$result[1]="$Email is not properly formatted"
        return 
$result
    } 




   list ( 
$Username$Domain ) = split ("@",$Email); 

   if (
getmxrr($Domain$MXHost))  { 

        
$ConnectAddress $MXHost[0]; 
    } else { 

        
$ConnectAddress $Domain

    } 


        
$Connect fsockopen $ConnectAddress25 ); 

    if (
$Connect) { 

        if (
ereg("^220"$Out fgets($Connect1024))) { 

           
fputs ($Connect"HELO $HTTP_HOST\r\n"); 
           
$Out fgets $Connect1024 ); 
           
fputs ($Connect"MAIL FROM: <{$Email}>\r\n"); 
           
$From fgets $Connect1024 ); 
           
fputs ($Connect"RCPT TO: <{$Email}>\r\n"); 
           
$To fgets ($Connect1024); 
           
fputs ($Connect"QUIT\r\n"); 
           
fclose($Connect); 
            if (!
ereg ("^250"$From) || 
!
ereg "^250"$To )) { 
               
$result[0]=false
               
$result[1]="Server rejected address"
               return 
$result

            } 
        } else { 

            
$result[0] = false
            
$result[1] = "No response from server"
            return 
$result
          } 

    }  else { 

        
$result[0]=false
        
$result[1]="Can not connect E-Mail server."
        return 
$result
    } 



    
$result[0]=true
    
$result[1]="$Email appears to be valid."
    return 
$result


?>