]> _ Git - psq.git/commitdiff
wait #7973 @2
authorVincent Vanwaelscappel <vincent@cubedesigners.com>
Wed, 4 Feb 2026 17:15:18 +0000 (18:15 +0100)
committerVincent Vanwaelscappel <vincent@cubedesigners.com>
Wed, 4 Feb 2026 17:15:18 +0000 (18:15 +0100)
app/Jobs/ProcessEmailBatch.php

index 06358d70e399763abd064a4d12d28628b3a5a348..0ab455208b096a818705d7814d25217856dd3623 100644 (file)
@@ -149,18 +149,25 @@ class ProcessEmailBatch implements ShouldQueue
         $this->templateVariables = $this->processVariablesForMailer();
 
         foreach ($this->users as $user) {
-            Mail::send([], [], function ($message) use ($user) {
-                $h = $this->html;
-                $h = str_replace('%name%', $user->name, $h);
-                $h = str_replace('%url%', $this->batch->file->getMailableUrl($user), $h);
-                $h = str_replace('%cover%', $this->batch->file->coverUrl, $h);
-
-                $message->from(config('mail.from.address'), config('mail.from_name'));
-                $message->subject($this->batch->subject);
-                $message->setBody($h, 'text/html');
-                $message->to($user->email);
-                $message->replyTo(env('MAIL_REPLYTO'));
-            });
+            for ($j = 0; $j < 4; $j++) {
+                try {
+                    Mail::send([], [], function ($message) use ($user) {
+                        $h = $this->html;
+                        $h = str_replace('%name%', $user->name, $h);
+                        $h = str_replace('%url%', $this->batch->file->getMailableUrl($user), $h);
+                        $h = str_replace('%cover%', $this->batch->file->coverUrl, $h);
+
+                        $message->from(config('mail.from.address'), config('mail.from_name'));
+                        $message->subject($this->batch->subject);
+                        $message->setBody($h, 'text/html');
+                        $message->to($user->email);
+                        $message->replyTo(env('MAIL_REPLYTO'));
+                    });
+                    break;
+                } catch (\Exception $e) {
+                    sleep(30);
+                }
+            }
 
             $this->processUpdate([
                 'status' => 'processing',