daveearley / Email-Validation-Tool

An easy to use, accurate-ish & extensible email validation library for PHP 7+ 📧

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

DNS validation fallacy

msigley opened this issue · comments

It is perfectly valid for a domain to not have an MX record but have a valid A record instead and receive email. Its definitely not best practice but it follows the spec for email delivery.

I wrote a similar PHP library in the past and handled this issue and bad dns providers who return results for all A record look ups. Feel free to reference it to fix this issue.

https://github.com/msigley/mailcheck-php/blob/b9e8003c59ea7d542100b6ba991676ea69220b62/mailcheck.php#L177

True. The official (RFC specified) fallback for no MX record in the zone, is the A record.

Thanks for the info @msigley! I'll update the code to reflect this