Support the ongoing development of →
posted 9 years ago
Mail Queues
Last updated 1 year ago.

We need to think about WHY we use a queue in the first place. One of the reasons we want to use a queue to send out emails is that we don't want to block the execution of our code, which decreases perceived performance on the users' end. If sending an email takes less than...say 0.001 sec, you might not notice any performance gain by using a queue.

That doesn't mean you should stop using a queue since you can't guarantee that the email sever is going to spend 0.001 all the time. It can take longer.

Last updated 1 year ago.

In order to benefit from using queues you need to either have a queue server running (i.e. beanstalkd, amazon SQS etc) or use push queues (i.e.

The queue library has various drivers. The default driver is 'sync', which essentially processes immediately (not in a separate process or queue). This is so that you can write your code as if you have a queue, but don't necessarily need to set one up in your development environment.

Last updated 1 year ago.

Thanks for the answers.

Just so that I make sure that I understand. I configure it in config/queue.php then Mail::queue should work? Or is there something else that I need to do?

Also, what is your preference? beanstalkd or I'm looking for something free at this point since my client's budget is practically non-existent.

Last updated 1 year ago.

you can simply install beanstalkd and configure the localhost endpoint on queue.php config file.

then you can queue tasks up the default tube (queue).

even though you are queueing tasks it doesn't mean they are being ran. truth is they aren't. you must have a worker for this. you can run artisan queue:work for a single task pop or artisan queue:listen for continuous polling on the queue.

you can also run the listener with supervisor to ensure the listener is always running.


Last updated 1 year ago.

Sign in to participate in this thread!


Your banner here too?

jerauf jerauf Joined 16 Feb 2014


We'd like to thank these amazing companies for supporting us

Your logo here?

The Laravel portal for problem solving, knowledge sharing and community building.

© 2024 - All rights reserved.