I found some websites that claim to verify if email addresses are valid. Is it possible to check if an email address is valid using just PHP?
<?php
if($_POST['email'] != ''){
// The email to validate
$email = $_POST['email'];
// An optional sender
function domain_exists($email, $record = 'MX'){
list($user, $domain) = explode('@', $email);
return checkdnsrr($domain, $record);
}
if(domain_exists($email)) {
echo('This MX records exists; I will accept this email as valid.');
}
else {
echo('No MX record exists; Invalid email.');
}
}
?>
<form method="POST">
<input type="text" name="email">
<input type="submit" value="submit">
</form>
This is what I have right now. It checks if the domain exist, but it cannot check if the
user's email exist on that domain. Is it possible to do that using PHP?
Question&Answers:
os 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…