0
votes

I'm having trouble with queues when sending email. Emails are sent when I use the send method:

Mail::send

When I switch to the queue method and configure the jobs table, QUEUE_DRIVER and the failed_jobs table, all the jobs in the queue end up in the failed_jobs table. I haven't touched anything on the queue.php file.

Running on Windows 7 as my developer environment.

PHP Version 5.6.15

Does this feature use curl(because phpinfo shows that it is enabled)?

Code:

.env file

QUEUE_DRIVER=database

Mailer

Mail::queue('emails.orderEmail',
      [
      'user' => Auth::user()
    ], function ($m) {
        $m->from($this->business->email, $this->business->business_name);
        $m->to($this->recipientEmail);
        $m->subject($this->subject);
        $m->replyTo($this->business->email, $this->name);
      });

I'm running this artisan command (tried queue:work as well to avail):

 php artisan queue:listen --tries=3
1
Delete your log file, and run your script again and see the log file, wonders eh? You most likely have syntax error somewhere. You can also open up failed_jobs table and see the stack trace there.Kyslik
@Kyslik I've a php SERVER variable called STORE_ID that seems to produce an exception error. Is it not accessible when sending via queue? [2017-06-23 12:33:22] local.ERROR: exception 'ErrorException' with message 'Undefined index: STORE_ID' in C:\xampp\htdocs\Server1\app\ShippingSettings.php:18 Stack trace:andromeda

1 Answers

0
votes

You have to pass that STORE_ID session variable to the mail view.

Mail::queue('emails.orderEmail',
  [
  'user' => Auth::user(),
  'store_id' => session('STORE_ID')
], function ($m) {