Make sure the email is a 'valid' email. Byb this I mean make sure that it fits all the rules of a proper email.
if(preg_match("/[a-z0-9._-\$]?@(([a-z0-9-]+.)?[a-z0-9-]+.[a-z]{2,3}|[[0-9]{1,3}.[0-9]{1,3}.[0-9]{1,3}.[0-9]{1,3}])$/i",$friend[$i]))
{
//Email is fine, go on with script
}
else
{
//Bad email
}