1. Advertising
    y u no do it?

    Advertising (learn more)

    Advertise virtually anything here, with CPM banner ads, CPM email ads and CPC contextual links. You can target relevant areas of the site and show ads based on geographical location of the user if you wish.

    Starts at just $1 per CPM or $0.10 per CPC.

email address exist or not????

Discussion in 'PHP' started by fafa7080, Oct 21, 2008.

  1. #1
    hi all
    iam newbie in php
    i want to create a form in php
    in which it has some filelds
    like username:
    email address1:
    email address2:
    email address3:

    submit buttom

    i want to create a form something look like this in which the person who is
    member of my site will put his username in the filed
    and he has to introduce 3 valid email addresses in their corresponding fields
    to get some advantages from my site
    but i want to have some procedure in which it checks the email addresses
    to see whether they are real email addresses
    and by clicking submit button one copy of the 3 email addresses will be emailed to me as well

    how can i do that to check the email addresses to see they are real
    is there any way to do that
    suppose the user enters a@yahoo.com or something which is not exists
    i mean i want to check both the domain name and the email address
    maybe he enters a@domiannotexist.com or a@yahoo.com
    in which in both the first the domain is not exist
    and second the email address is not valid or maybe deactivated
    how can i check that
    and by the way i want to be sure that the user out the email address
    also correctly
    suppose he does not miss @ and if he did the error message shows that
    this@ is missing

    is it possible suppose to use a smtp server inside the code
    to email the address which the user puts inside the filed
    and it automatically emails the 3 email addresses
    and if the mail daemon delivery emails back it will undrestand that the email
    is not correct or does not exist and near the filed of that email address shows email is not verified
    but is should read the header of the email
    cause maybe the server has some auto response which is not a mail delivery deamon

    is there any way i can do this?
     
    fafa7080, Oct 21, 2008 IP
  2. sarahk

    sarahk iTamer Staff

    Messages:
    28,498
    Likes Received:
    4,460
    Best Answers:
    123
    Trophy Points:
    665
    #2
    sarahk, Oct 21, 2008 IP
  3. fafa7080

    fafa7080 Member

    Messages:
    37
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    41
    #3
    thanks for the reply
    but did u get any code?
     
    fafa7080, Oct 22, 2008 IP
  4. chemouriamine

    chemouriamine Peon

    Messages:
    20
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    0
    #4
    Hello ALL,

    I hope you're fine,

    so for amil validation using a simple php script use this:

    
     
    function checkEmail($email) 
    {
       if(eregi("^[a-zA-Z0-9_]+@[a-zA-Z0-9\-]+\.[a-zA-Z0-9\-\.]+$]", $email)) 
       {
          return FALSE;
       }
     
       list($Username, $Domain) = split("@",$email);
     
       if(getmxrr($Domain, $MXHost)) 
       {
          return TRUE;
       }
       else 
       {
          if(fsockopen($Domain, 25, $errno, $errstr, 30)) 
          {
             return TRUE; 
          }
          else 
          {
             return FALSE; 
          }
       }
    }
     
     
    
    PHP:
    How to use it ?

    in your php script use :

    
     
     
    if(checkEmail(a@yahoo.com) == FALSE) 
    {
       echo "E-mail entered is not valid.";
    } 
    else 
    {
       echo "E-mail entered is valid.";
    }
     
    
    PHP:
    But thsi way check only email domain (I mean the name aftre '@' character like 'yahoo.com') , or a regular expresions , but not checking if email is real and it exist !!

    How to do that ?
    You can use some of features of this website : http://www.network-tools.com

    and for the validation email send "GET" request like this
    
    http://network-tools.com/default.asp?prog=validate&host=[Email Address]
     
    example :
     
    http://network-tools.com/default.asp?prog=validate&host=info@csphennaya.com
    
    PHP:
    and server's response will be like this :

    1- If Email is valide :

    
     
    
    Validation results 
    canonical address: <info@csphennaya.com> 
    MX records preferenceexchangeIP address (if included)0csphennaya.com[74.220.215.58]SMTP session [Contacting csphennaya.com [74.220.215.58]...]
    [Connected]
    220-host258.hostmonster.com ESMTP Exim 4.69 #1 Wed, 22 Oct 2008 18:00:24 -0600 
    220-We do not authorize the use of this system to transport unsolicited, 
    220 and/or bulk e-mail.
    EHLO Network-Tools.com
    250-host258.hostmonster.com Hello Network-Tools.com [67.222.132.194]
    250-SIZE 52428800
    250-PIPELINING
    250-AUTH PLAIN LOGIN
    250-STARTTLS
    250 HELP
    VRFY info
    252 Administrative prohibition
    RSET
    250 Reset OK
    EXPN info
    550 Administrative prohibition
    RSET
    250 Reset OK
    MAIL FROM:<admin@Network-Tools.com>
    250 OK
    RCPT TO:<info@csphennaya.com>
    250 Accepted
    RSET
    250 Reset OK
    QUIT
    221 host258.hostmonster.com closing connection
    [Connection closed]
    
    
    PHP:
    you can write a small script that check if the response text contain "250 Accepted" that means : email is valide

    2- If Email is not valide :

    
    
    Validation results error: Recipient rejected
    
    canonical address: <nothing@csphennaya.com> 
    MX records preferenceexchangeIP address (if included)0csphennaya.com[74.220.215.58]SMTP session [Contacting csphennaya.com [74.220.215.58]...]
    [Connected]
    220-host258.hostmonster.com ESMTP Exim 4.69 #1 Wed, 22 Oct 2008 18:01:09 -0600 
    220-We do not authorize the use of this system to transport unsolicited, 
    220 and/or bulk e-mail.
    EHLO Network-Tools.com
    250-host258.hostmonster.com Hello Network-Tools.com [67.222.132.194]
    250-SIZE 52428800
    250-PIPELINING
    250-AUTH PLAIN LOGIN
    250-STARTTLS
    250 HELP
    VRFY nothing
    252 Administrative prohibition
    RSET
    250 Reset OK
    EXPN nothing
    550 Administrative prohibition
    RSET
    250 Reset OK
    MAIL FROM:<admin@Network-Tools.com>
    250 OK
    RCPT TO:<nothing@csphennaya.com>
    550 No Such User Here
    [Address has been rejected]
    RSET
    250 Reset OK
    QUIT
    221 host258.hostmonster.com closing connection
    [Connection closed]
    
     
    
    PHP:
    you can write a small script that check if the response text contain "550 No Such User Here" that means : email is not valide

    end;

    but I think that's the most used an effecient way to check email is : BY SENDING A VALIDATION LINK TO THIS EMAIL OR VALIDATION NUMBER ....

    because the way of pinging email server , take time and you will have a very slowly page , and some error daily ...

    Best Regards

    CHEMOURI.

    Happy to help other
     
    chemouriamine, Oct 22, 2008 IP