]> _ Git - psq.git/commitdiff
wait #8073 @0.25 master
authorVincent Vanwaelscappel <vincent@cubedesigners.com>
Wed, 18 Mar 2026 15:46:37 +0000 (16:46 +0100)
committerVincent Vanwaelscappel <vincent@cubedesigners.com>
Wed, 18 Mar 2026 15:46:37 +0000 (16:46 +0100)
.env.production
app/Jobs/ProcessEmailBatch.php
config/app.php

index df68a691f3c48e7dcf1311e9bf0d020598039f75..7243f0943bab368f9e5c968274e9acb84356655d 100644 (file)
@@ -49,11 +49,18 @@ MAIL_MAILER=mailgun
 #Mailgun
 MAILGUN_SIGN_KEY="565a54d53dd589271b7ce51b451c2f9e-aa4b0867-7a09fa43"
 MAILGUN_API_KEY="565a54d53dd589271b7ce51b451c2f9e-aa4b0867-7a09fa43"
+MAILGUN_SECRET=565a54d53dd589271b7ce51b451c2f9e-aa4b0867-7a09fa43
 MAILGUN_DOMAIN="email.prescription-quotidien.com"
 MAILGUN_TEST_MODE=no
-MAILGUN_SECRET=565a54d53dd589271b7ce51b451c2f9e-aa4b0867-7a09fa43
 MAILGUN_ENDPOINT=api.eu.mailgun.net
 
+#MAILGUN_SIGN_KEY="d9b9d88f289ab3a68dfeeca0e48572c2-ccbfdc2c-f7f8f5fd"
+#MAILGUN_API_KEY="d9b9d88f289ab3a68dfeeca0e48572c2-ccbfdc2c-f7f8f5fd"
+#MAILGUN_SECRET="d9b9d88f289ab3a68dfeeca0e48572c2-ccbfdc2c-f7f8f5fd"
+#MAILGUN_DOMAIN=sandboxed4b7470d0044151991d2009409eb5ec.mailgun.org
+#MAILGUN_TEST_MODE=yes
+#MAILGUN_ENDPOINT=api.mailgun.net
+
 MAIL_FROM_ADDRESS=noreply@email.prescription-quotidien.com
 MAIL_FROM_NAME="Prescription Santé - Le Quotidien"
 MAIL_REPLYTO=olivier.robichon@prescription-quotidien.com
index 0ab455208b096a818705d7814d25217856dd3623..0eb4a20ecf5a0ff56c8f438cf940650dfd4f718d 100644 (file)
@@ -15,11 +15,14 @@ use Illuminate\Contracts\Queue\ShouldQueue;
 use Illuminate\Database\Eloquent\Builder;
 use Illuminate\Database\Eloquent\Collection;
 use Illuminate\Foundation\Bus\Dispatchable;
+use Illuminate\Mail\Message;
 use Illuminate\Queue\InteractsWithQueue;
 use Illuminate\Queue\SerializesModels;
 use Illuminate\Support\Arr;
+use Illuminate\Support\Facades\Log;
 use Illuminate\Support\Facades\Mail;
 use Illuminate\Support\Str;
+use Swift_Message;
 
 
 class ProcessEmailBatch implements ShouldQueue
@@ -147,11 +150,13 @@ class ProcessEmailBatch implements ShouldQueue
 
         $this->html = $this->batch->render();
         $this->templateVariables = $this->processVariablesForMailer();
+        $batchID = $this->batch;
 
         foreach ($this->users as $user) {
-            for ($j = 0; $j < 4; $j++) {
+            for ($j = 0; $j < 1; $j++) {
                 try {
-                    Mail::send([], [], function ($message) use ($user) {
+                    Mail::send([], [], function ($message) use ($user, $batchID) {
+                        /* @var Message $message */
                         $h = $this->html;
                         $h = str_replace('%name%', $user->name, $h);
                         $h = str_replace('%url%', $this->batch->file->getMailableUrl($user), $h);
@@ -162,10 +167,12 @@ class ProcessEmailBatch implements ShouldQueue
                         $message->setBody($h, 'text/html');
                         $message->to($user->email);
                         $message->replyTo(env('MAIL_REPLYTO'));
+                        $message->getSwiftMessage()->getHeaders()->addTextHeader('X-Mailgun-Tag', $batchID);
                     });
                     break;
                 } catch (\Exception $e) {
-                    sleep(30);
+                    Log::error($e);
+                    sleep(60);
                 }
             }
 
index 7412901ddc7575fabeca62c1376c1140507acd4c..0d64adde33b5a40a90bbe844871fe03e9922ae12 100644 (file)
@@ -128,7 +128,7 @@ return [
     'version' => '1.0.0',
 
     'emails' => [
-        'subscriptions' => 'abonnement@prescription-quotidien.com',
+        'subscriptions' => 'test+psq@fluidbook.com',
         'olivier' => 'olivier.robichon@prescription-quotidien.com',
         'moi' => 'test+psq@fluidbook.com'
     ],