我正在向许多用户发送电子邮件,我想添加bbc,发送本身正在运行但是当我添加bbc
时我收到此错误
call_user_func_array() expects parameter 1 to be a valid callback, class 'Swift_Message' does not have a method 'bbc'
我正在发布控制器:
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('mg.kvelichkov@gmail.com', 'МГ "Константин Величков"');
$message->to($user);
$message->bbc($user);
});
}
return "Your email has been sent successfully";
}
}