From a0fce194020b3fad7c9a13fd0c52dc227a426d3a Mon Sep 17 00:00:00 2001 From: isaacclad Date: Mon, 8 Jun 2026 15:04:19 +0000 Subject: [PATCH] Fix transfer recipient emails not sending in production. Map MAIL_ENCRYPTION to a valid SMTP scheme, send recipient notifications synchronously, document mail/queue env vars, and add a supervisor worker template. Co-authored-by: Cursor --- .../TransferRecipientNotification.php | 3 +-- config/mail.php | 13 ++++++++++++- deploy/shared.env.example | 11 +++++++++++ deploy/supervisor/ladill-transfer-worker.conf | 14 ++++++++++++++ 4 files changed, 38 insertions(+), 3 deletions(-) create mode 100644 deploy/supervisor/ladill-transfer-worker.conf diff --git a/app/Notifications/TransferRecipientNotification.php b/app/Notifications/TransferRecipientNotification.php index 670e58e..9450a19 100644 --- a/app/Notifications/TransferRecipientNotification.php +++ b/app/Notifications/TransferRecipientNotification.php @@ -4,11 +4,10 @@ namespace App\Notifications; use App\Models\Transfer; use Illuminate\Bus\Queueable; -use Illuminate\Contracts\Queue\ShouldQueue; use Illuminate\Notifications\Messages\MailMessage; use Illuminate\Notifications\Notification; -class TransferRecipientNotification extends Notification implements ShouldQueue +class TransferRecipientNotification extends Notification { use Queueable; diff --git a/config/mail.php b/config/mail.php index e32e88d..46c64b1 100644 --- a/config/mail.php +++ b/config/mail.php @@ -1,5 +1,16 @@ $mailScheme, + $mailScheme !== '' => null, + in_array($mailEncryption, ['ssl', 'smtps'], true) => 'smtps', + in_array($mailEncryption, ['tls', 'starttls', 'smtp'], true) => 'smtp', + default => null, +}; + return [ /* @@ -39,7 +50,7 @@ return [ 'smtp' => [ 'transport' => 'smtp', - 'scheme' => env('MAIL_SCHEME'), + 'scheme' => $smtpScheme, 'url' => env('MAIL_URL'), 'host' => env('MAIL_HOST', '127.0.0.1'), 'port' => env('MAIL_PORT', 2525), diff --git a/deploy/shared.env.example b/deploy/shared.env.example index 67590d8..c907bec 100644 --- a/deploy/shared.env.example +++ b/deploy/shared.env.example @@ -28,6 +28,17 @@ SESSION_DRIVER=database SESSION_LIFETIME=120 SESSION_DOMAIN=.ladill.com +QUEUE_CONNECTION=database + +MAIL_MAILER=smtp +MAIL_HOST=mail.ladill.com +MAIL_PORT=587 +MAIL_USERNAME=noreply@ladill.com +MAIL_PASSWORD= +MAIL_ENCRYPTION=tls +MAIL_FROM_ADDRESS=noreply@ladill.com +MAIL_FROM_NAME="Ladill Transfer" + LADILL_SSO_CLIENT_ID= LADILL_SSO_CLIENT_SECRET= diff --git a/deploy/supervisor/ladill-transfer-worker.conf b/deploy/supervisor/ladill-transfer-worker.conf new file mode 100644 index 0000000..60b72b1 --- /dev/null +++ b/deploy/supervisor/ladill-transfer-worker.conf @@ -0,0 +1,14 @@ +[program:ladill-transfer-worker] +process_name=%(program_name)s_%(process_num)02d +command=php /var/www/ladill-transfer/current/artisan queue:work database --sleep=3 --tries=3 --timeout=2100 --max-time=3600 --max-jobs=1000 +autostart=true +autorestart=true +stopasgroup=true +killasgroup=true +user=www-data +numprocs=1 +redirect_stderr=true +stdout_logfile=/var/www/ladill-transfer/shared/storage/logs/worker.log +stdout_logfile_maxbytes=10MB +stdout_logfile_backups=5 +stopwaitsecs=3600