0

I am working in a PHP based project. I am sending emails via PHP's email function using PHPMailer class.

Problem:

How can I detect if an email actually doesn't exists. I want to remove that email from my list. Can we do it via PHP? or any other way please give me a direction.

Irfan DANISH
  • 8,349
  • 12
  • 42
  • 67
  • how do you get these emails from user ? OR some other means ? – CS GO Feb 27 '14 at 12:59
  • [Duplicate here](http://stackoverflow.com/questions/565504/how-to-check-if-an-email-address-exists-without-sending-an-email) – CS GO Feb 27 '14 at 13:01
  • 3
    I can give you some keywords: 1. RegExp the mail address, 2. do a DNS lookup on the host part of the mail address and compare MX entries, 3. send a mail and parse the response 4. fetch incoming mails and detect bounced mails, error response mails from foreign mail server. – Daniel W. Feb 27 '14 at 13:01
  • You can use a monstrous RegExp for the format (like one of these : http://hexillion.com/samples/) and check that there's a valid MX record on the domain with `getmxrr()` http://uk1.php.net/getmxrr ... but other than actually sending an email to that address and dealing with the bounces you can't be 100% certain. – CD001 Feb 27 '14 at 13:01
  • Yes from users, they enter in my product. And I just wanna sure they actually exists. – Irfan DANISH Feb 27 '14 at 13:02
  • @CD001 how to check bounce back emails via PHP? – Irfan DANISH Feb 27 '14 at 13:03
  • @AncientGeek Can you please give me more information in option 3 and 4? how to get response or how to fetch incomming email from PHP? – Irfan DANISH Feb 27 '14 at 13:05
  • here's your answer http://stackoverflow.com/questions/3794959/easiest-way-for-php-email-verification-link – nowhere Feb 27 '14 at 13:06
  • 1
    @IrfanDANISH to do it automatically you'd need a mailbox on the server and then probably get into the whole ugly world of `IMAP` http://uk1.php.net/manual/en/book.imap.php ... can't really give you a better answer, I know it can be done but I've never had to do it I'm afraid. – CD001 Feb 27 '14 at 13:08

0 Answers0