I'm sending emails to many users and i want to add bbc, the sending itself is working but when I add bbc
i'm getting this error
call_user_func_array() expects parameter 1 to be a valid callback, class 'Swift_Message' does not have a method 'bbc'
I'm posting the controller:
use Illuminate\Http\Request;
use App\User;
use Illuminate\Support\Facades\Mail;
use App\Http\Requests;
use App\Http\Controllers\Controller;
class EmailController extends Controller
{
public function sendEmail(){
$users = User::where('type','student')->pluck('email');
foreach ($users as $user) {
Mail::send('emails.test', ['user' => $users], function ($message) use ($users, $user) {
$message->from('[email protected]', 'МГ "Константин Величков"');
$message->to($user);
$message->bbc($user);
});
}
return "Your email has been sent successfully";
}
}