mardi 25 septembre 2018

How to process email queued in Laravel

I've a AWS SQS, and I successfully created a notification system which saves the message in the AWS SQS queue.

In the code:

protected function saveNotificationEmail($subject, $msg)
{                          
    Mail::to(       
        $this->getUserRecord()->email
    )->queue(new Alert($subject, $msg));
}

The object "Alert" has been created via CLI php artisan make:mail Alert.

Now, when I run the code, the queue has a new item; so everything works fine for putting the data into the queue. When I run php artisan queue:work, I get series of messages like the following:

[2018-09-25 22:37:43] Processing: App\Mail\Alert
[2018-09-25 22:37:48] Processing: App\Mail\Alert
[2018-09-25 22:37:52] Processing: App\Mail\Alert
[2018-09-25 22:37:57] Processing: App\Mail\Alert

Out of 2 messages in the queue, 1 has been processed perhaps I got no email.. I tested the emailing system without the queue method, and it's working fine. What am I missing?

I guess the problem is very similar to this question which didn't had answer



via Chebli Mohamed

Aucun commentaire:

Enregistrer un commentaire