Beautiful Open-Source Form Builder
Fix workspace SMTP not updating in queue workers (#1018)
Julien Nahum355ef5f2073e
diff --git a/api/app/Notifications/Forms/FormEmailNotification.php b/api/app/Notifications/Forms/FormEmailNotification.phpindex 6f21a772b..19f74ab21 100644--- a/api/app/Notifications/Forms/FormEmailNotification.php+++ b/api/app/Notifications/Forms/FormEmailNotification.php@@ -8,6 +8,7 @@ use App\Service\Forms\FormSubmissionFormatter;use App\Service\Forms\SubmissionUrlService;use Illuminate\Notifications\Messages\MailMessage;use Illuminate\Notifications\Notification;+use Illuminate\Support\Facades\Mail;use Illuminate\Support\Str;use Symfony\Component\Mime\Email;@@ -45,6 +46,11 @@ class FormEmailNotification extends Notification'mail.mailers.custom_smtp.username' => $emailSettings['username'],'mail.mailers.custom_smtp.password' => $emailSettings['password']]);++ // Laravel caches mailer instances (and their transport) in long-lived processes+ // like queue workers (Horizon). If workspace SMTP settings change, we must purge+ // the cached mailer so the next send uses the updated config.+ Mail::purge('custom_smtp');return 'custom_smtp';}