I have a Lumen app (v8) configured for sending emails using Mailgun. Everything works flawlessly when I send the mail immediately, but when I try to use the “later” method it seems to be ignored.
This is what I am using:
file app.php
$app->configure('services');
$app->configure('mail');
$app->configure('queue');
$app->alias('mail.manager', IlluminateMailMailManager::class);
$app->alias('mail.manager', IlluminateContractsMailFactory::class);
$app->alias('mailer', IlluminateMailMailer::class);
$app->alias('mailer', IlluminateContractsMailMailer::class);
$app->alias('mailer', IlluminateContractsMailMailQueue::class);
$app->make('queue');
the Onboard3.php mail class:
<?php
namespace AppMail;
use IlluminateBusQueueable;
use IlluminateContractsQueueShouldQueue;
use IlluminateMailMailable;
use IlluminateQueueSerializesModels;
use IlluminateSupportFacadesDB;
class Onboard3 extends Mailable
{
use Queueable, SerializesModels;
/**
* Create a new message instance.
*
* @return void
*/
public $info;
public function __construct($info)
{
$this->info = $info;
}
/**
* Build the message.
*
* @return $this
*/
public function build()
{
return
$this->from('[email protected]', 'Sender name')
->subject("Subject")
->view('emails.users.onboard3')
->text('emails.users.onboard3_plain');
}
}
My controller method:
Mail::to([
'[email protected]'
])
->later(
Carbon::now()->addMinutes(10000)
, new Onboard3($recipient)
);