I have the following code which (I think) will only verify the domain of the email address.
$EmailAddress = "user@domain.com";
list($User, $Domain) = explode("@", $EmailAddress);
$DomainExists = checkdnsrr($Domain, 'MX');
if($DomainExists==true){
// Email domain exists
}
else{
// Email domain does not exist
}
If I can, how do I verify the $User
part?
The only guaranteed way to make sure user@example.com
exists is sending them an e-mail with a verification link.
Here's another post on how to do that: Easiest way for PHP email verification link
The only way you can tell if an email address exists is to send email to it with a task for the user to perform (usually clicking on a link), for the email not to be caught in spam filters, and for the recipient to perform the task.