1

I have a form in my asp.net site. when user fills email id text box, I want to make sure whether that email id is valid or invalid(existing or not existing).

Ex: john@gmail.com is valid, john@xxxyyy.com is not valid.

How to find it whether it is valid or not. please help me. I searched some stack overflow. even though I didn't get.

Faisal
  • 179
  • 1
  • 4
  • 15
  • check out this posting - http://stackoverflow.com/questions/1365407/c-sharp-code-to-validate-email-address – MethodMan Oct 04 '16 at 16:05

5 Answers5

1

There is no way to for you to know if an email account actually exists other than to send an email and see what happens. A delivery failure notice might be sent, but that is not guaranteed to be sent, and even if it is, it might not be sent for days depending on how many delivery attempts are made.

You can send a verification email which contains a URL of a web service you control and passes a unique ID. The email owner clicks on the URL and is directed at your web service. You look at the unique ID and now you know the email address exists.

user1666620
  • 4,800
  • 18
  • 27
0

https://emailhunter.co/api/docs#email-verification - is a web service API to check email addresses

Markus
  • 420
  • 3
  • 7
0

try to create an email id in mail server. if exist it will return an existing mail return message.

0

You could use the built-in Microsoft SmtpClient Class if you know the adress of your SMTP server. The Send Method returns an exception when the delivery fails. Again, this is only a suggestion and perhaps too overwhelming for what you need, but this class is rather useful in C#.

  • Boivin sometimes even mail has not sent I am not getting failure error message. I don't know why. I gave wrong mail id. But it does not show any error message – Faisal Oct 04 '16 at 21:30
  • Do you have a Try Catch block with the proper Expression type? How do you handle exceptions in your code? – François Boivin Oct 05 '16 at 16:44
  • Like user1666620 said, a delivery failure is not garanteed to be sent by the SMTP server, and even so, it can takes a lot of time. To help you debug your problem, you could add a method that suscribe to the event OnSendCompleted and see if it is really sent or no. – François Boivin Oct 05 '16 at 16:52
0

Send one link on that email address with some query string parameters and based on those parameters activate their user profile otherwise not activate..

So based on this methodology, you can verify email address is valid or not.