1

I have tried a lot but could not find a way by which I will find if an email id exists or not.

My problem is that I do not want to make visitor to email me with fake email Id. Is there any solution for this? I do not want to use smpt service as it send mail to solve this.

6
  • 3
    No, the only way is to actually send the mail. Feb 11, 2014 at 14:46
  • Thanks for reply @thorsten then how can I stop visitor to contact me with wrong email Id
    – Amit Yadav
    Feb 11, 2014 at 14:48
  • what about yahoo and hotmail as they do not bounce the email for wrong email Id
    – Amit Yadav
    Feb 11, 2014 at 14:51
  • 4
    You can't. hello"I am an email".mail+maaaail@com is a valid email address. You cannot control what the external mailserver will do. The only way to validate email addresses is to send an email and get the user to do something with it, though even that doesn't necessarily mean that mailbox will exist next time you try to send to it.
    – Phoshi
    Feb 11, 2014 at 14:53
  • 1
    Think about your question from a spammers' viewpoint. Let me check these bulk addresses and once verified just spam them like hell.
    – Luceos
    Feb 11, 2014 at 15:50

3 Answers 3

5

The only way to check if

  • the address is valid
  • the mailbox is working
  • the email was given by the owner

is to send a confirmation email with a link and a unique token. The recipient will then click on the link and confirm that the he got the email.

Summarized:

  1. Generate a unique ID and store it along with the hashed supplied email address
  2. Send an email to the address with a URL to your validation application/script (e.g., https://example.com/validate/id=UNIQUEID&email=HASHEDEMAIL)
  3. When the URL is clicked your application will check if the unique ID corresponds to what you generated and sent to the user
9
  • You should map the email and the id and not send the email as a plain url parameter. This way the user could just authenticate another not working email address with the same id.
    – Lukei
    Feb 11, 2014 at 15:58
  • @Templar, if the email is not working the user will never get the generated ID.
    – Matteo
    Feb 11, 2014 at 16:03
  • 2
    @Templar no because in step 1 you store the info the you can then compare. In your small DB you fill find no match for this ID with another address. There is one ID per address that will have to match.
    – Matteo
    Feb 11, 2014 at 16:12
  • 1
    Matteo, Templar has a point it is best not to send the email as a GET request it would be prudent to send it either as POST or better yet a hash of the email that way 1. if someone broke into your database the email would just be gibberish and 2. if the user's connection to your server is compromised a hash would mean nothing to the middle party.
    – gabeio
    Feb 11, 2014 at 16:16
  • 2
    @gabe It wanted to keep the example easy to understand. I don't know how much the OP knows. Of course hiding the info would be nice I just fear that the answer will be more confusing.
    – Matteo
    Feb 11, 2014 at 16:19
2

Don't have them enter an email.
Instead rely on a different company to validate the email. Use something like OAUTH/2 with google or twitter... IE: google wants the same thing as you, no fake accounts. They go through lengths to confirm that the account that is created is real and connected to someone real so have your application/page/etc ask them to connect to their google account which will provide you with a valid email.

https://developers.google.com/accounts/docs/OAuth2

0

I have done this in the past in PHP using SwiftMailer, but you could probably achieve the same in straight php.

If you send your email with a from address like [email protected] (which is a real address to which you have access) the email will be sent back to that box.

From there, you can have a planned task to check for emails in that box, grab the email to which you sent it and flag de user as a user with an invalid address and don't send anymore communication to them. After processing the email, you could either delete the email in the box or store it in an other folder.

When I did it, I an a requirement to keep a copy of every email sent by the application. To identify every unsuccessful deliveries, I added a unique key to the email headers which was grabed back by the code analysing the rebound mailbox and I could flag every correspondances sent (ex: 2 first message were successfully delivered, but the 3rd and 4th were not)

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.