Click here to Skip to main content
15,891,136 members
Please Sign up or sign in to vote.
1.00/5 (1 vote)
See more:
How can I check to given email address is available or not ?

I am using ASP.NET to create my study project & I face problem to check if email address is valid or not ?

I use RegularExpressionValidator to check email but it checks pattern of emailID such as email address contains "@" and ".". Is doesn't check domain name or if such email already exist in the world or not.
So how can I check if given emailID is valid or not ?

How can I check if a given email address is available or not ?
Posted
Updated 5-Feb-11 1:41am
v2

You can validate if the given email id is as per current structure or not. Apart from that, given that there are thousands of websites facilitate creating email accounts, it is not advisable to check if the email address is valid or not.

If you are really after having a correct email id of the user, send a account verification mail with a link in it. Unless user verifies the email address, do not allow to use the website.
 
Share this answer
 
Comments
GenJerDan 5-Feb-11 9:18am    
Couldn't he use the raw protocol up to VRFY to see if it's a valid address at the host?
dan!sh 6-Feb-11 16:25pm    
Well, I could just pull any random email address and register in that case. Not that my way is 100% secure, but is better than just checking if email is valid or not.
There are two parts to validating an email address;
1. the username or the bit to the left of the @ symbol
2. the domain in the address or the bit to the right of the @ symbol.

For the second part you can do a DNS MX record lookup[^] however for the first item the only way to check is to send an email and checking of it bounces (assuming that the email server is configured to send bounce emails for non existent usernames).

All this is assuming that the address given complies with the rules of the regex expression for a valid email address.
 
Share this answer
 
 
Share this answer
 

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