嗨,我创建了一个 laravel 队列作业来发送邮件
public function handle() {
foreach($this->emails as $value) {
$to = $value->email;
$subject = $this->data['subject'];
$this->data['t_firstname'] = $value->firstname;
$this->data['t_lastname'] = $value->lastname;
if (view()->exists('mail.requirement_to_tutor')) {
$view = view('mail.requirement_to_tutor',$this->data);
$html = $view->render();
}
file_put_contents('test.txt', 'test database');
$body = $html;
$headers = "From: " . $this->data['from'] . "\r\nReply-To: " . $this->data['from'] . "";
$headers .= "MIME-Version: 1.0\r\n";
$headers .= "Content-type: text/html; charset: utf8\r\n";
mail($to, $subject, $body, $headers);
}
}
而且我正在从回购中推送数据
$obj = (new SendStudentRequirement($TutorsbyCity,$data));
$this->dispatch($obj);
但它不作为后台运行,该功能正在等待队列完成,请帮帮我