I am trying to program a Laravel mailing list with a queue Try to send emails to Non-users, I did a good job with registered users and this is my code:
foreach ($emails as $i=>$item){
$user = User::where('email',$item)->first();
if ($i % $mailsCount == 0)$count++;
if ($user){
$thisBody = ElzahabyDynamicLaravelString($user,$body,$this->sign);
$thisSubject = ElzahabyDynamicLaravelString($user,$subject,$this->sign);
$when = Carbon::now()->addMinutes($every*$count);
Mail::to($user)
->later($when,new EmailForQueuing($user,$thisBody,$thisSubject,$request->emailTemplate));
}
}
You can notice later() method, which is responsible for the queue. but this only works with Mail::to method which only works for registered users.
So, any idea how to send a mailing list with a queue to non-registered emails.
Thanks in advance.
Edit 1
EmailForQueuing() method is a simple Mailable class