通过Gmail发送邮件,'bbc'无效 - Laravel 5.2

时间:2016-04-13 21:42:38

标签: php email laravel gmail

我正在向许多用户发送电子邮件,我想添加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";
    }
}

0 个答案:

没有答案