Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Is there any way to detect whether an email address belongs to an existing account?

There is way to detect whether an email id is well-formed or not. Example [email protected] is a well-formed email address, but this may or may not be valid email account.

  • Case 1 May be the domain doesnot exist (e.g. def.com here).
  • Case 2 If the domain is valid then may be the id doesnot exist for the domain (eg abcqs username doesnot exist for def domain).

If it is not valid then if we sent mail, we will get some delivery failure mail, maybe in some hours after sending the email.

I want to implement a similar concept. I want to verify if an email id belongs to a valid account, which will find out whether the account exists or not.

How to achieve it?


2 Answers

I think a better approach is to send an email and verify it the user activates the account.

  1. The user fills in his email
  2. You create a link to be acessed by the user, passing some parameter to him. Example: http://your.domain.com/activate?account=984239048302948203482390
  3. You save the email and all info in your database, with a flag (a field) indicating that it hasn't being activated yet, and the code you sent him
  4. When he clicks the link, you'll receive that parameter in your site, in some program you have wrote. So you'll know that the parameter 984239048302948203482390 has been used
  5. You verify if that code exists in your database and activate the account.

And them he's verified.

You can check your database, every x days, and remove all the old entries, like one that weren't validated more than one week ago.

like image 79
woliveirajr Avatar answered Nov 18 '25 23:11

woliveirajr


Unfortunately, you cannot know if it's valid until you actually send the message, as it's the remote server that decides whether or not the address is valid. All your local computer knows how to do is route the message to the appropriate domain for processing.

You could check to see if the domain name resolves if you wanted, but you still wont know if the exact email address exists.

like image 39
Nick Avatar answered Nov 18 '25 22:11

Nick



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!