Hi,
I want to get each line of e-mail accounts from my txt file and put them in an array after checking the syntax.
I made a few tries but can't accomplish on that here is my text file look like:
mails.txt
he@yourdomain.com
she@yourdomain.com
me@yourdomain.com
you@yourdomain.com
And here is my code:
<?
$filename = file("mails.txt");
foreach($filename as $line){
$syntax_ok_emails = preg_match('/^[A-z0-9_\-]+\@(A-z0-9_-]+\.)+[A-z]{2,4}$/', $line);
if($syntax_ok_emails){
$e_mails[] = $syntax_ok_emails;
}
}
foreach($e_mails[] as $value){
echo $value;
}
?>