From a controller, I dispatched a job to send a welcome email using
$this->dispatch(new SendWelcomeEmail($user));
In SendWelcomeEmail Job I'm doing
public function handle(Mailer $mailer)
{
$mailer->send('emails.welcome', ['data' => 'data'], function ($m) {
$m->from('[email protected]', 'Noreply');
$m->to('[email protected]', 'xyz')->subject('Welcome');
});
}
My .env file is configured to be
QUEUE_DRIVER=database
MAIL_DRIVER=smtp
MAIL_HOST=email-smtp.us-east-1.amazonaws.com
MAIL_PORT=587
MAIL_USERNAME=*access*
MAIL_PASSWORD=*key*
MAIL_ENCRYPTION=tls
Checked:
- Database migrations - 'Jobs' tables
- Ran the queue listener before job dispatch trigger using
php artisan queue:listen
Problem: The jobs are loaded on to the 'jobs' table in the database but are not processed. But this works completely fine when I update the queue drive.
QUEUE_DRIVER=sync
What am i missing here?