#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
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
$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);
$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);
}
}
'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'
],