How can I implement following logic?
-
User registers with an e-mail address
-
If provided e-mail address is a valid
email address Then user account get’s
activated -
or if it is a fake email then user
account is not activated
I doubt that I can catch the – “Delivery failed reply message”, right?
anyhow how would you suggest to implement the above logic?
PS. I will have to find a way no matter what, client wants it =)
You probably want to be sure not only that the e-mail address is valid, but also that it belongs to this particular user. The usual way to do this is to send an e-mail with a link. The user has to click the link to activate the account.
For example, the link could look like this:
where the
tokenis a random string that you generated and stored in your database, linked to that account. The server-side code behind theactivatepage will then activate the account. If you don’t get a hit for thistokenwithin, say, a week, you can clean up the account and the activation token.Addition in reply to your comment…
An alternative way would be to initiate an SMTP connection, and try to begin sending an e-mail. This is similar to callback verification amongst mail servers. For example (
<is what the mail server says,>is what your script might send):There are several serious problems with this approach, which is why it is not used in practice. Most of these will result in incorrectly accepted messages, some will cause the check to fail entirely:
hotmail.com, pretty much any address you can imagine will be taken.See also the Postfix manual and a disputed section on Wikipedia. I hope this list is long enough to convince your client that there is no good solution to his problem, and that he should stop asking the impossible from you.