Skip to content

Instantly share code, notes, and snippets.

@fenric
Created March 6, 2017 02:36
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save fenric/33e73f9594e82bf7c544f09ca5605717 to your computer and use it in GitHub Desktop.
Save fenric/33e73f9594e82bf7c544f09ca5605717 to your computer and use it in GitHub Desktop.
<?php
$email = 'test@mail.ru';
function valid_email($email)
{
if (filter_var($email, FILTER_VALIDATE_EMAIL))
{
list($user, $host) = explode('@', $email, 2);
if (checkdnsrr($host, 'MX'))
{
return true;
}
}
return false;
}
var_dump(valid_email($email));
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment