05-19-2016, 02:43 AM
You can also use PHP's getmxrr() function to see if a hostname has an MX record:
if (getmxrr('hostname.com')) {
echo 'Has at least one MX record so send an email';
}
However this doesn't guarantee an address exists, only that a hostname is setup to receive email.
if (getmxrr('hostname.com')) {
echo 'Has at least one MX record so send an email';
}
However this doesn't guarantee an address exists, only that a hostname is setup to receive email.