I need to send reminder emails to users in queue
Currently I have
UserController.php
public function postSendUsersPaymentRequest(Request $request){
$users_ids = $request->get('user_checked');
dispatch(new SendPaymentRequestEmail($users_ids));
return response()->json(['code' => 200], 200);
}
\\App\\Jobs\\SendPaymentRequestEmail.php
public function handle(UserRepository $userRepo)
{
$users = $userRepo->getUserInfoDetails(3,1,1)->whereIn('user_id',$this->users_ids);
foreach($users as $user){
$this->emailPaymentRequest($user);
}
}
private function emailPaymentRequest($user){
Mail::queue($this->email_vew, ['user' => $user], function ($m) use ($user) {
$from = Config::get('mail.from');
$project_name = Config::get('app.project_name');
$m->from('fromemail', $project_name);
$m->to('toemail', $user->name)->subject('Payment Request');
});
}
But email is sending without queuing.
Thanks for any help in advance.
将QUEUE_DRIVER=database
添加到您的.env文件中。
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.