mail message sending delay
This commit is contained in:
1 parent
1963d6fcce
commit
dae8336ac9
2 files changed
+15
-3
No files matched your search
@@ -15,6 +15,9 @@ class SendNewsletter
|
||||
{
|
||||
public static function mailit($record)
|
||||
{
|
||||
|
||||
ini_set('max_execution_time', -1);
|
||||
|
||||
/***
|
||||
"name" => "Arch Versand 2026"
|
||||
"mail_gruppen_id" => 1
|
||||
@@ -63,6 +66,7 @@ class SendNewsletter
|
||||
|
||||
$mails_send = 0;
|
||||
|
||||
$delay = 0;
|
||||
foreach ($adressen as $adresse) {
|
||||
|
||||
$data = [];
|
||||
@@ -91,7 +95,9 @@ class SendNewsletter
|
||||
|
||||
$data['unterschrift'] = $template->unterschrift;
|
||||
|
||||
SendNewsletterJob::dispatch($data);
|
||||
SendNewsletterJob::dispatch($data, $delay);
|
||||
|
||||
$delay++;
|
||||
|
||||
$mails_send++;
|
||||
}
|
||||
|
||||
@@ -13,12 +13,15 @@ class SendNewsletterJob implements ShouldQueue
|
||||
|
||||
public $data;
|
||||
|
||||
public $delay;
|
||||
|
||||
/**
|
||||
* Create a new job instance.
|
||||
*/
|
||||
public function __construct($data)
|
||||
public function __construct($data, $delay = 0)
|
||||
{
|
||||
$this->data = $data;
|
||||
$this->delay = $delay;
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -27,6 +30,9 @@ class SendNewsletterJob implements ShouldQueue
|
||||
*/
|
||||
public function handle(): void
|
||||
{
|
||||
Mail::to($this->data['email'])->send(new Newsletter($this->data));
|
||||
// Mail::to($this->data['email'])->send(new Newsletter($this->data));
|
||||
|
||||
Mail::to($this->data['email'])->later(now()->addSeconds($this->delay), new Newsletter($this->data));
|
||||
|
||||
}
|
||||
}
|
||||
Reference in new issue
Block a user