在控制器中(maildata和query_string是数组并被发送):
$this->dispatch(new SendBulkRegisterEmail($maildata,$query_string));
在SendBulkRegisterEmail
中public $query_string, $maildata;
public function __construct($maildata, $query_string)
{
$this->query_string = $query_string;
$this->maildata = $maildata;
}
/**
* Execute the job.
*
* @return void
*/
public function handle()
{
try{
for ($i=0; $i < count($this->maildata) ; $i++) {
$mailers = $maildata[$i];
Mail::send('mails.new_user_mail', $mailers, function($message) use ($mailers)
{
$message->to($mailers["toemail"],$mailers['studentname'])->subject($mailers['subject']);
});
}
}catch(Exception $e){
}
}
邮件未发送。有人请帮忙 在此先感谢