Search code examples
phpemailsmtpports

Email Verifier PHP


My goal is to make an emailVerifier.php which send an email to see if the actual email adress exist or not.

That's what I've done from this library : https://github.com/hbattat/verifyEmail And it's works really well in local, but when I try on my website online, the server doesn't responding yet so it can't verify the adress.

I've tried 3 different SMTP ports 25, 587, 465, but nothing changes. Any ideas of where the problem should be ?

Thannk you.


Solution

  • Man, this is way harder than this because of how ESPs react to bad email addresses.

    You can't necessarily validate an email address without being signed up for one of the various feedback loops.

    What you can do is validate that an email conforms the RFC using php, or check that MX records exist from the DNS. But you can't figure out if the email address conforms to the house styles of various email services.

    A more robust way to do this is this project:

    https://github.com/mailgun/flanker

    If you just want to do the MX records use this:

    https://packagist.org/packages/service-to/validate-email