emailcleanercodefeatureimg

Domain-Based Email Verification in CSV File using PHP.

Hello Friends, In this blog post I am going to let you know to build an email verification functionality based on domain address inside your email CSV file. I make it more simple, suppose you have an email CSV file which has bulk email addresses and having multiple domain addresses for email.

Now the problem is that you have email addresses with domain extension say ABC.com, and you don’t want to keep any email address with this particular domain name and want to delete all of them,

so now the question is how would you delete them for email verification?

Though there could be some other way to remove as such domain from your excel file for email verification, in case if you don’t know the way or you not familiar with the more technical thing then you would need to have a tool which can do this work for you.

You can use this below-given a tool for email verification process where you just need to upload your list and select the domain which you want to remove or keep and if the domain you want to delete is not in the drop-down list then you can also manually add or delete the domain the below-given option.

csv-email-cleaner-softwrae-img
Email Verification Domain Specific

*Note – Domain add and delete functionality is disabled in the live demo. If if you have any query related with live demo then please contact us here.

So using this tool email verification can happen both ways, you can remove the domain you want and you can also keep the domain you want, means you can select the emails with a specific domain name and also can delete the email with a specific name.

What is the process to make this email verification tool?

This is a very simple process to build this email verification tool, you just need to follow the below-given procedure.

1. Install all the applications to develop this functionality.

Software required to develop this functionality are :

NetBeans IDE
Xampp Server

2. Now create a project name as excel_cleaner, though you can create with any name and then create the below-given file structure.

project-detailexcelcleaner

Once the project creation is done with all file and folder then just copy and paste the below-given code for email verification tool.

index.php


[php]

<?php
session_start();
ini_set(“display_errors”, 0);
?>
<html>
<head>
<meta http-equiv=”Content-Type” content=”text/html; charset=windows-1252″>
<link href=”style.css” rel=”stylesheet” type=”text/css”/>
<link href=”bootstrap/css/bootstrap.css” rel=”stylesheet” type=”text/css”/>
<link href=”bootstrap/css/bootstrap-theme.min.css” rel=”stylesheet” type=”text/css”/>
<title>Remove Email With Domain From Excel</title>
</head>
<body>
<div class=”container”>
<div class=”row”>
<h1 class=”main_heading”>Remove Email With Domain From Excel</h1>
<div id=”main”>
<div id=”login”>
<h2>Email Domain Remover</h2>
<hr>
<div id=”right”>
<div id =”form1″ >

<form action=”<?php echo $_SERVER[“PHP_SELF”]; ?>” method=”post” enctype=”multipart/form-data”>
<?php
$server = “localhost”;
$username = “root”;
$password = “”;
$link = @mysql_connect($server, $username, $password) or die(“Cannot connect to mysql server: ” . @mysql_error());
$dbname = ‘test’;
@mysql_select_db($dbname, $link) or die(“Cannot connect to database: ” . @mysql_error());

$query = “SELECT id,domainname from domain”;
$result = @mysql_query($query);
echo “<select name=’dname’ value=’domain’>”;
while ($drop = @mysql_fetch_array($result)) {
echo “<option value=$drop[domainname]>$drop[domainname]</option>”;
}
echo “</select>”;
?>
<label><b>Upload CSV :</b></label>
<label><input type=”file” name=”file” id=”file” /></label>
<input type=”submit” name=”csubmit” id=”csubmit” value=”submit”/>
</form>
<form action=”#” method=”get” id=”registerform”>
<input type=”text” name=”username” placeholder=”Domainname”></input><br/>

<input type=”submit” name=”submit” value=”Add”></input>
<input type=”submit” name=”deletercd” value=”Delete”></input>
</form>
</div>
<div style=”text-align: center;”><a href=””>For exporting more email please click here..</a> </div>
</div>
</div>
</div>
<div id=”csvmailcontent”>

<?php
try {
if (isset($_POST[‘csubmit’])) {

$sample3 = $_POST[‘dname’];
$sample1 = ‘abc’;
$sample2 = ‘@’;

$input = $sample1 . $sample2 . $sample3;
// echo $input;

if (isset($_FILES[“file”])) {
//if there was an error uploading the file
if ($_FILES[“file”] [“error”] > 0) {
echo “<script type=’text/javascript’>alert(‘Please choose File for upload’)</script>”;
} else {
$storagename = $_FILES[“file”][“name”];
$_SESSION[‘file_name’] = $storagename;
$id = $_SESSION[‘file_name’];
$row = 1;
move_uploaded_file($_FILES[“file”][“tmp_name”], “upload/” . $storagename);
$file = new SplFileObject(“upload/” . $storagename);
$file->setFlags(SplFileObject::READ_CSV);
$file->setCsvControl(‘,’, ‘”‘, ‘\\’); // this is the default anyway though
foreach ($file as $value) {
foreach ($value as $row) {
$arcsv[] = $row;
}
}
$arcsv = array_unique($arcsv);
$_SESSION[‘csv_value’] = $arcsv;
if (empty($arcsv)) {
$arcsv = $_SESSION[‘csv_value’];
}
$countarcsv = count($arcsv);
if($countarcsv >20){
echo (“<script LANGUAGE=’JavaScript’>
window.alert(‘You exceed the one time limit of 20 emails’);
window.location.href=’http://localhost/excel_cleaner/index.php’;
</script>”);
}
/*This will remove all the Gmail.com address*/
if (preg_match(‘/\w+([-+.]\w+)*@(gmail\.com)$/i’, $input)) {
$matches = preg_grep(‘/\w+([-+.]\w+)*@(gmail\.com)$/i’, $arcsv,PREG_GREP_INVERT);
/*This will select all the yahoo addresses*/
// print_r($matches);
} elseif (preg_match(‘/\w+([-+.]\w+)*@(yahoo\.com)$/i’, $input)) {
$matches = preg_grep(‘/\w+([-+.]\w+)*@(yahoo\.com)$/i’, $arcsv);

//print_r($matches);
}

echo”<table id =’tid’>”;
echo”<th>”;
echo”<b>”;
echo”Result Emails”;
echo”</b>”;
echo”</th>”;
foreach ($matches as $key) {
echo”<tr>”;
echo”<td>”;
echo $key . “<br/>”;
echo”</td>”;
echo”</tr>”;
}
echo”</table>”;
$arcsv1[] = $matches;
$lists1 = json_encode($arcsv1);
}
}
if (!empty($file)) {
echo”<form action=’csvdown.php’ method=’post’ >
<input type=’hidden’ name=’lists1′ value=’$lists1′ />
<button type=’submit’ value=’Export CSV’ id =’csvsubmit’><u>Export CSV<u></button>
</form>”;
}
}
} catch (MyException $e) {
echo “Some thing went wrong”;
}
?>
<?php
if (isset($_GET[‘submit’])) {
$con = mysql_connect(“localhost”, “root”, “”);
//Selecting Database
$db = mysql_select_db(“test”, $con);

$username = $_GET[‘username’];

if($username==””)
{
echo”Please fill all the fields”;
}
else{

$query=mysql_query(“insert into domain (domainname) values (‘$username’)”);
if($query){
echo (“<script LANGUAGE=’JavaScript’>
window.alert(‘Your domain has been added successfully’);
window.location.href=’http://localhost/excel_cleaner/index.php’;
</script>”);}

mysql_close($con); // Closing the connection
}

}

if (isset($_GET[‘deletercd’])) {
$con = mysql_connect(“localhost”, “root”, “”);
//Selecting Database
$db = mysql_select_db(“test”, $con);

$username = $_GET[‘username’];

if($username==””)
{
echo”Please fill all the fields”;
}
else{

$query=mysql_query(“DELETE from domain where domainname = ‘$username'”);
if($query){
echo (“<script LANGUAGE=’JavaScript’>
window.alert(‘Your domain has been deleted successfully’);
window.location.href=’http://localhost/excel_cleaner/index.php’;
</script>”);

}
mysql_close($con); // Closing the connection
}

}
?>

</div>
</div>
</div>
</body>
</html>

[/php]

csvdown.php


[php]

<?php

ini_set(“display_errors”, 0);
?>
<?php
try {
$array2 = json_decode($_POST[‘lists1’]);
foreach ($array2 as $key) {
foreach ($key as $key1) {
$array3[][] = $key1;
}
}
header(“Content-type: text/csv”);
header(“Content-Disposition: attachment; filename=file.csv”);
header(“Pragma: no-cache”);
header(“Expires: 0”);
$data = $array3;
$file = fopen(‘php://output’, ‘w’);
fputcsv($file, array(‘Emails ‘));
foreach ($data as $row) {
fputcsv($file, $row);
}
exit();
} catch (MyException $e) {

echo “Some thing went wrong”;
}
?>

[/php]

Style.css


[css]

@import url(http://fonts.googleapis.com/css?family=Raleway);
#main{
min-width: 350px;
margin: 44px auto;
font-family:raleway;
}
span{
color:red;
}
h1.main_heading {
text-align: center;
}
h2{
background-color: #FEFFED;
text-align:center;
border-radius: 10px 10px 0 0;
margin: -10px -40px;
padding: 15px;
}
hr{
border:0;
border-bottom:1px solid #ccc;
margin: 10px -40px;
margin-bottom: 30px;
}
#login{
border-radius: 10px;
font-family:raleway;
border: 2px solid #ccc;
padding: 10px 40px 33px;
margin-top: 23px;
}
input[type=text],input[type=email]{
width:99.5%;
padding: 10px;

border: 1px solid #ccc;
padding-left: 5px;
font-size: 16px;
font-family:raleway;
}
input[type=submit]{
width: 37%;
background-color:#FFBC00;
color: white;
border: 2px solid #FFCB00;
padding: 4px;
font-size:20px;
cursor:pointer;
border-radius: 5px;
}
#right{
overflow: hidden;
overflow-wrap: break-word;
width: 104%;
border: 1px dashed rgb(215, 215, 215);
box-shadow: 0px 5px 17px 1px #99A3AD, 0px 0px 40px #EEEEEE;
margin-left: -10%;
padding: 20px;
}
#right p{
padding: 20px;
}
form1 {
padding-top: 27px;
width: 248px;
margin: auto;
}
#right h3 {
margin-top: -8px;
text-align: center;
}
#csvmailcontent{
width:60%px;
font-family:raleway;
margin-top: -4%;
}
#mailsubmit{
background:none!important;
border:none;
padding:0!important;
font: inherit;
border-bottom:1px solid #444;
cursor: pointer;
font-size: 150%;
margin-left: 45%;
}
#csvsubmit{
background:none!important;
border:none;
padding:0!important;
font: inherit;
border-bottom:1px solid #444;
cursor: pointer;
font-size: 150%;
margin-left: 45%;
}
#uploadcsv
{
margin-bottom: 5%;
}
#text1{
margin-top: 1%;
margin-bottom: 11px;
}
input#text1 {}
#or{
margin-left: 45%;
font-size: 20px;
font-family:raleway;
margin-top: -50px;
}
#or:hover{
color: #204d74;
z-index: 8;
}
#file{
color:lightblue;
margin-top: 3px;
margin-bottom: 4px;
}
table {
font-family: ‘Raleway’, sans-serif;
color:#666;
font-size:12px;
text-shadow: 1px 1px 0px #fff;
background:#eaebec;
margin:20px;
border:#ccc 1px solid;
font-size: 16px;
-moz-border-radius:3px;
-webkit-border-radius:3px;
border-radius:3px;
-moz-box-shadow: 0 1px 2px #d1d1d1;
-webkit-box-shadow: 0 1px 2px #d1d1d1;
box-shadow: 0 1px 2px #d1d1d1;
margin: 0 auto;
}
table th {
text-align: center;
padding:21px 25px 22px 25px;
border-top:1px solid #fafafa;
border-bottom:1px solid #e0e0e0;

background: #ededed;
background: -webkit-gradient(linear, left top, left bottom, from(#ededed), to(#ebebeb));
background: -moz-linear-gradient(top, #ededed, #ebebeb);
}
table th:first-child {
text-indent: center;
padding-left:20px;
}
table tr:first-child th:first-child {
-moz-border-radius-topleft:3px;
-webkit-border-top-left-radius:3px;
border-top-left-radius:3px;
}
table tr:first-child th:last-child {
-moz-border-radius-topright:3px;
-webkit-border-top-right-radius:3px;
border-top-right-radius:3px;
}
table tr {
text-indent: center;
padding-left:20px;
}
table td:first-child {
text-align: center;
padding-left:20px;
border-left: 0;
}
table td {
padding:18px;
border-top: 1px solid #ffffff;
border-bottom:1px solid #e0e0e0;
border-left: 1px solid #e0e0e0;
background: #fafafa;
background: -webkit-gradient(linear, left top, left bottom, from(#fbfbfb), to(#fafafa));
background: -moz-linear-gradient(top, #fbfbfb, #fafafa);
}
table tr.even td {
background: #f6f6f6;
background: -webkit-gradient(linear, left top, left bottom, from(#f8f8f8), to(#f6f6f6));
background: -moz-linear-gradient(top, #f8f8f8, #f6f6f6);
}
table tr:last-child td:first-child {
-moz-border-radius-bottomleft:3px;
-webkit-border-bottom-left-radius:3px;
border-bottom-left-radius:3px;
}
table tr:last-child td:last-child {
-moz-border-radius-bottomright:3px;
-webkit-border-bottom-right-radius:3px;
border-bottom-right-radius:3px;
}
table tr:hover td {
background: #f2f2f2;
background: -webkit-gradient(linear, left top, left bottom, from(#f2f2f2), to(#f0f0f0));
background: -moz-linear-gradient(top, #f2f2f2, #f0f0f0);
}
@media only screen and (min-width:768px){
#main {
max-width: 370px;
}
}

[/css]

Once you are done with this process to complete all the file and page then you can run your project for email verification and can test the result.

In the case of any queries, you can write to us at a5theorys@gmail.com we will get back to you ASAP.

Hope! you would have enjoyed this post of email verification tool development.

Please feel free to give your important feedbacks in the comment section below.

Have a great time! Sayonara!

csvemailcleaner-feature

CSV Email Cleaner: Remove emails of a specific domain

Hello Friends, In this blog, I am going to let you know about CSV email cleaner tool or software. Sometimes did you need to remove some specific email addresses from your email CSV? Make it more simple, say you have millions of emails with different domain extensions like most of them are gmail.com and yahoo.com and any other, etc.

What does this CSV email cleaner actually do? What is the procedure?

You can see the screenshot for the CSV email cleaner software below, here you can select a particular domain which you want to remove or select. Here in the demo of this software, we have included both the functionality for adding and removing the emails of a particular domain extension. In the below demo when you will select the gmail.com then it will remove all the emails with this gmail.com extension and when you will select yahoo.com then it will select all the emails with yahoo.com extension.

csv-email-cleaner-softwrae-img
CSV EMAIL CLEANER

*Note – Domain add and delete functionality is disabled for the live demo.

And now you want to remove all the email having gmail.com domain extension from your email CSV, there could be many reasons behind this as you don’t want to send emails to this domain email or this is fake domain extension which you want to remove from your email CSV file. You can easily remove all emails with this particular domain extension using this CSV email cleaner tool.

csvemailcleaner1
Removal of gmail.com using CSV email cleaner

There may be another case where you have millions of email addresses in your email CSV file with different domain extension and now you just need to select a particular domain extension based emails say you just want to extract yahoo.com emails out of all the emails and export them in an email CSV file. So you can easily select them all with this CSV email cleaner tool.

csvemailcleaner2
Selection of all yahoo.com using CSV email cleaner

The format of the CSV file that you need to upload is given below while using CSV email cleaner. Remember only to upload file in CSV format.

samplecsv

Conclusion:

So this CSV email cleaner is an amazing tool which can filter all your email address based on a particular domain name. you can easily remove and select the emails based on domain extensions in your email CSV file.

In the case of any queries, you can write to us at a5theorys@gmail.com we will get back to you ASAP.

Hope! you would have enjoyed this post about CSV email cleaner.

Please feel free to give your important feedbacks in the comment section below.

Have a great time! Sayonara!