Wednesday, 18 October 2023

email address validator – Email MX DNS Record Check

Validate email instantly with our cutting-edge free online email verification tool: simply enter the email address in the box below, and our advanced email validator will provide you with real-time email deliverability results!

 

<form name="myForm" method="post" action="#">

<center><h1>Please Enter Email Address:</h1></center><br/><br />

<input type="email" style="width: 100%;height:50px;" name="email" id="email" placeholder="admin@adquash.com"><br /><br />

 <center><input type="submit" value="Check" id="dsubmit" class="btn btn-blue" name ="submit"><br/><br/> </center>

</form>

<?php

if (isset($_POST['submit'])) {

$email = $_POST['email'];

/*

* Getting Domain part from user input Email-Address

*/

$domain = substr(strrchr($email, "@"), 1);

/*

* This Function is used for fetching the MX data records to a corresponding

- Email domain

*/


function mxrecordValidate($email, $domain) {


$arr = dns_get_record($domain, DNS_MX);

if ($arr[0]['host'] == $domain && !empty($arr[0]['target'])) {

return $arr[0]['target'];

}

}


echo"<table id ='tid' >";

echo"<th>";

echo"Result";

echo"</th>";

echo"<tr>";

echo"<td>";


if (mxrecordValidate($email, $domain)) {

echo("<br>This MX records exists. <br><b>'$email' is Valid Email Address</b><br>.");

if (checkdnsrr($domain, "A")) {

    echo "$domain has an A record";

} else {

    echo "$domain does not have an A record";

}

$data = dns_get_record($domain, DNS_MX);

foreach ($data as $key1) {

echo "<br>Host:- " . $key1['host'] ;

echo "<br>Class:- " . $key1['class'] ;

echo "<br>TTL:- " . $key1['ttl'] ;

echo "<br>Type:- " . $key1['type'] ;

echo "<br>PRI:- " . $key1['pri'] ;

echo "<br>Target:- " . $key1['target'] ;

echo "<br>Target-IP:- " . gethostbyname($key1['target']) ;

}

echo"</td>";

echo"</tr>";

} else {

echo("<br>No MX record exists. '$email' is Invalid Email Address.");

}

echo"</td>";

echo"</tr>";

echo"</table>";

}

?>