Domain names are those names which are provided by DNS server to each IP addresses querying for an HTTP request.

In this blog post, I am going to show whether an Email Domain exists or not. It will certainly help you in email cleaning and perfect email list management.

Following are the benefits achieved by verifying the Email Domain –

  1. Restrict sending emails to all those emails whose domain doesn’t exist.
  2. No fake user can enter to your web portal or contact list.

Let’s have a look at the brief summary of domain name system/server(DNS) and domain name.

Domain name system came into existence with the invention of the internet. It is an authorized organization which provide a specific name to your IP address (127.0.0.1 as example.com) and let you communicate to anyone in the network.

Imagine for a while that you have to enter the IP address of Google every time, then you will get frustrated after some time-spam, though it is the matter of only one address, what will happen when you have to enter IP addresses of several sites.

It’s almost impossible to remember IP address of each host in the internet network, for this purpose DNS provide us a unique domain name for further communication with any IP addresses in the internet network.

Domain Name hierarchy

Let’s have a look at different types of domain name available:- email-domain-verification-img

This above image explains about the hierarchy of DNS. Root is at the top and then .com, .net, .org, .gov, .mil  are considered as generic top-level domains(gTLD).

  • .COM –  For any Commercial purpose,  like www.google.com.
  • .ORG –  For different Organization, like http://www.humanhealth.org.
  • .NET – For Network Solution, like  http://www.besthistory.net

And like this .gov for government and .mil for army(military) section so we have a broad classification of the domain name.

domain verification


For sending emails and related functionality, you can take a look at our premium service MailGet. It’s a user friendly online service in which you can also integrate different smtp.

Index.php

This page will display a form to enter different address. The submitted values will be retrived and checked whether the entered address contains a valid domain name or not. On the basis of result, it will display a message.

<html>
<head>
<link href="css/style.css" rel="stylesheet" type="text/css"/>
<title>Find Email Domain Exist or Not</title>
<meta http-equiv="Content-Type" content="text/html; charset=windows-1252">
</head>
<body>
<div class="container">
<div class="row">
<div class="col-sm-1 col-md-2 col-lg-12">
<div id="main" class="col-sm-1 col-md-2 col-lg-12">
<div class="col-sm-1 col-md-2 col-lg-12"><h1>Find Email Domain Exist or Not</h1> </div>
<div id="login">
<h2>Verify Email Domain</h2>
<div id="right">
<form name="myForm" method="post" action="index.php">
Please Enter Email Address:
<input type="email" size=18 name="email" id="email">
<div class="col-sm-1 col-md-2 col-lg-12"> <input type="submit" value="Check" id="dsubmit" name ="submit"></div>
</form>
<label id ="lbmesg">
<?php
if (isset($_POST['submit'])) {
$email = $_POST['email'];
$domain = substr(strrchr($email, "@"), 1);
/* This code verify a registered of valid domain name */
if ($result = fopen("http://$domain", 'r')) {
echo $domain . " Exist";
} else {
echo $domain . " Not Exist";
}
}
?>
</label>
</div>
</div>
</div>
</div>
</div>
</body>
</html>

style.css

Includes basic styling of HTML elements.

@import url(http://fonts.googleapis.com/css?family=Raleway);
body{
margin: 0 auto;
padding: 0 auto;
}
#main{
width: 100%;
margin:4% auto;
font-family:raleway;
}
span{
color:red;
}
h1{
text-align:center;
font-family:raleway;
}
h2{
background-color: #FEFFED;
text-align:center;
border-radius: 10px 10px 0 0;
margin: -10px -40px;
padding: 15px;
font-family:raleway;
}
hr{
border:0;
border-bottom:1px solid #ccc;
margin: 10px -40px;
margin-bottom: 30px;
}
#login{
width: 289px;
border-radius: 10px;
font-family:raleway;
border: 2px solid #ccc;
padding: 10px 40px 33px;
margin-top: 23px;
margin: 0 auto;
}
input[type=text],input[type=password]{
width:99.5%;
padding: 10px;
margin-top: 8px;
border: 1px solid #ccc;
padding-left: 5px;
font-size: 16px;
font-family:raleway;
}
#email{
width:99.5%;
padding: 10px;
border: 1px solid #ccc;
padding-left: 5px;
font-size: 16px;
font-family:raleway;
}
input[type=submit]{
width: 98%;
background-color:#FFBC00;
color: white;
border: 2px solid #FFCB00;
padding: 10px;
font-size:20px;
cursor:pointer;
border-radius: 5px;
}
#profile{
padding:50px;
border:1px dashed grey;
font-size:20px;
background-color:#DCE6F7;
}
i{
color: black;
padding: 18px;
margin: 20px;
}
#right{
width: 72.1%;
height: 220px;
border: 1px dashed rgb(215, 215, 215);
box-shadow: 0px 5px 17px 1px #99A3AD, 0px 0px 40px #EEEEEE;
padding: 10%;
margin-left: 10px;
}
#right p{
padding: 20px;
}
#paypal_logo{
margin: 10px 315px;
float: right;
}
#results {
width: 100%;
margin-top: 30px;
table-layout: auto;
margin-bottom: 30px;
}
#dsubmit{
margin-top: 5px;
}
#txtmsg
{
height: 100px;
width: 99.5%;
}
#lbmesg{
margin-top: 50px;
font-family:raleway;
}
@media only screen and (max-width:480px){
#main {
width: 100%;
}
#login {
width: 75%;
margin: 0 auto;
}
input[type=submit] {
width: 98%;
}
}

 

Conclusion :

Hope you would have learned & enjoyed  this blog post and would have got a clear picture about DNS. I am sure you will give a try to the script provided and implement it in your own projects as well. Feel free to visit our website again in the future to get in touch with new coding tricks. You can let us know about your feedback in the space provided below.