The problem is here:
foreach($users as $user) {
$sended = mail(...);
if($sended) {
return true;
}
}
You have a loop, but you leave it at the first cycle, when it succeeded.
I think you need this:
<?php
public function sendEmail($name,$email,$text) {
$users = $this->_mysqli->get("user",array("TRUE"));
$headers = 'From: '.$email."\n";
$headers .= 'Date: '.gmdate('D, d M Y H:i:s', time())."\n";
foreach($users as $user) {
$sended = mail($user["email"],'Contact from example.com',$name.' with email address: '.$email.' has contacted you: '.$text,$headers);
if(!$sended) {
return false;
}
}
return true;
}
?>