I am using the below code to validate emails
if (checkdnsrr($domain , "MX")) {
echo 'mx - pass <br>';
} else {
echo 'mx - fail <br>';
}
My desire is to check that the domain is valid and has an MX record.
I am already using a regular expression to check the email format, but people enter things like someone@gmail.con which obviously is wrong but pases basic format validation.
I want to validate further but I do not want to go too far and get false negatives.
Does anyone see any issue with my solution or have a better way?