mardi 28 novembre 2017

Why send email use mail laravel does not work if it use shouldqueue?

My mail laravel like this :

<?php
namespace App\Mail;
use Illuminate\Bus\Queueable;
use Illuminate\Mail\Mailable;
use Illuminate\Queue\SerializesModels;
use Illuminate\Contracts\Queue\ShouldQueue;
class OrderReceivedMail extends Mailable implements ShouldQueue
{
    use Queueable, SerializesModels;
    public $order;
    public $store;
    public function __construct($order, $store)
    {
        $this->order = $order;
        $this->store = $store;
        $this->subject('subject');
    }
    public function build()
    {
        $company_email = explode(',',config('app.mail_company'));
        return $this->view('vendor.notifications.mail.email-order-received',['number'=>$this->order->number, 'store_name' => $this->store->name])->bcc($company_email);
    }
}

My env like this :

BROADCAST_DRIVER=pusher
CACHE_DRIVER=redis
SESSION_DRIVER=file
QUEUE_DRIVER=redis

REDIS_HOST=127.0.0.1
REDIS_PASSWORD=null
REDIS_PORT=6379

If the code executed, it does not works. The email failed sended or the mail code not executed

But if I remove implements ShouldQueue, it works. The email success sended

Why if I use shouldqueue it does not works?



via Chebli Mohamed

Aucun commentaire:

Enregistrer un commentaire