Created
August 24, 2021 02:35
-
-
Save laztname/03bbd967757475ceb89e15fab3d0292c to your computer and use it in GitHub Desktop.
php simple check valid mail and mail server to prevent bounce
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
//include 'functions.php'; | |
$email = $_POST['mail']; | |
if(filter_var($email, FILTER_VALIDATE_EMAIL)) { | |
$domain = array_pop(explode('@', $email)); | |
if(checkdnsrr($domain, 'mx')) { | |
exit('mail sent'); | |
//mail($email, $subject, $message, $headers); | |
} else { | |
exit('mail server not found'); | |
} | |
} else { | |
exit('mail doesn\'t valid'); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment