How can we help?

Search our guides and tutorials, or browse the categories below.

Configuring Laravel SMTP Email and Queue Workers via Cron

Laravel SMTP Configuration (.env)

MAIL_MAILER=smtp
MAIL_HOST=mail.yourdomain.com
MAIL_PORT=465
MAIL_USERNAME=info@yourdomain.com
MAIL_PASSWORD=YourPassword
MAIL_ENCRYPTION=ssl
MAIL_FROM_ADDRESS="info@yourdomain.com"

Why Use Queue Workers for Email?

Synchronous email dispatch slows down user requests. Moving emails to background queues ensures instantaneous UI responses.

Database Queue Driver Setup

  1. Set QUEUE_CONNECTION=database in .env.
  2. Run migrations: php artisan queue:table && php artisan migrate

Scheduled Queue Worker via cPanel Cron

Run the worker every minute with automatic termination when jobs finish:

* * * * * cd /home/user/laravel_app && php artisan queue:work --stop-when-empty --tries=3 > /dev/null 2>&1
Was this helpful?

Thanks for your feedback!

Still Need Help?

Our support team is here around the clock for anything you can't find above.

WhatsApp Live Support