How to Check in asp.net the Email Id exists or not in asp.net
I want to know that when user registering how to check t开发者_C百科he email id is exists or not.
In order to validate an email you can use 2 things
- Send yourself an email and check the answer back (this can take up to 24 hours as email servers sometimes don't send the answer back right away) and read the response headers back from the email server
- You can signup for a commercial service that does this for you.
BUT
We never, ever, do this ...
We simply send the user an email with a confirmation link and block his/her account until they confirm it.
for example:
The user bruno
creates an account in your website with the email abc@domain.com
.
After you create the user in your User
table you also have a bit
(boolean) column
names is_confirmed
that you say 0
DECLARE @guid uniqueidentifier
SET @guid = NEWID();
INSERT INTO [TblUsers]
( 'email', 'username', 'is_confirmed', 'create_date', 'unique_id' )
VALUES
( 'abc@domain.com', 'bruno', 0, GETDATE(), @guid );
SELECT @guid;
then you send a nice Welcome email with the id you got form the insert procedure
http://yourdomain.com/confirm/?<%= userGuid %>
you simple send a Welcome message asking the user to confirm within that link, open confirm, welcome him and ask to provide a password.
That's how we see if the email is a real one or not!
If you want to know whether they have entered a genuine, real email address that they use, then the only way is to send them something then have them confirm it back to you.
If you just want to check the format is valid, then Google (or Bing if that is your preference) for email address verification regular expression
.
精彩评论