Using PHP Filters we can fully validate an email id and this filter option requires PHP 5 version.
Below is the code for validating emails in PHP using filters, along with using explode and foreach loop and then inserting the correct emails in the mysql database. Multiple emails validation.
Validate Emails Using Filters in PHP
//Validate bulk emails using filters with foreach loop and insert them in a table $email="vivek@gmail.com,admin@techfolks.net"; $email_array = explode(";",$email); foreach ($email_array as $email_result){ if (filter_var($email_result, FILTER_VALIDATE_EMAIL) == TRUE) { echo $email_result.' is Valid Email Address '." "; $con=mysql_connect("localhost","root",""); $db = mysql_select_db("validate", $con); $query = "INSERT INTO email(email,status) values('$email_result','ok')"; $res = mysql_query($query); } else { echo $email_result.' Invalid Email Address'." "; } } ?>