Click here to Skip to main content
14,868,583 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
Dear Friends,

I ve a text box to get E-Mail ID.
Using normal Javascript validation I can check weather entered string is email id or not.
But is there any option to find weather entered email id is valid one.
Eg. test@testing.com
In normal validation, It accept it as Email ID.
In real, there is no domain and email like this.
Is there any option to find it, if so kindly suggest.
Posted
Comments
Sibasisjena 13-Jul-12 9:17am
   
No you can not check a mailId is valid. If you want to do this the send a mail if you got response then that emailId is valid one.

No. The only way to find out is to send an email to the address and see if you get a response.

That is why so many systems send a registration completion message, which requires the user to follow a link to complete registration - it confirms that at the time of sending the email address was valid, and under the control of the actual user.

Even then, a couple of minutes later it may not be a valid address - 10 Minute Mail[^]

[edit]Whole bunch of typos... - OriginalGriff[/edit]
   
v2
NO language supports this kind of validation and IMHO it never should.
   
Basically you can adpot solution 1. But why to wait for 10 mins ? you can use the ping command to check wether the provided domain is a valid one or not.

for this you might need 2 things,

1. Internet Connection (to ping).
2. A small function which will return, wehther you got a response or not.

C#
public static bool IsConnectedToInternet
{
    get
    {
        //  Split email id and get domain name.
        Uri url = new Uri("www.testing.com"); // as per your example
        string pingurl = string.Format("{0}", url.Host);
        string host = pingurl;
        bool result = false;
        Ping p = new Ping();
        try
        {
            PingReply reply = p.Send(host, 3000);
            if (reply.Status == IPStatus.Success)
                return true;
        }
        catch { }
        return result;
    }
}


The PING sends an ICMP (Internet Control Message Protocol) echo request to the server and waits to receive the echo back. If the value of Status is success, the PingReply is successful.
   

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)




CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900