Hi there, have a basic email domain validation script that takes a user's email domain, resolves the
IP address from that and then checks that against various published blacklists. Here is how I am determining the IP:
$domain = substr(strchr($email, '@'), 1);
$ip = gethostbyname($domain);
The problem is that some email address domains, such as
[email protected], use an MX record rather than an A record, so using gethostbyname('alumni.example.net') will fail to resolve. I know when a user's email is using an MX in the email itself by using the PHP checkdnsrr function, but once at that stage am a little stuck as to how to proceed.
In theory, I could parse out the 'root' domain, i.e. 'example.net' and check it, but I've not found reliable regex that can handle this task when the user could easily have an email the format of
[email protected]...
So, any suggestions on how to best tackle this??