fix: prevent mail errors when email template body is null

This commit is contained in:
2026-01-25 15:10:11 -05:00
parent d6bd23eeb3
commit 259a905ea5

View File

@@ -31,6 +31,13 @@ class NotificationHelper
if (!$emailTemplate || !$emailTemplate->enabled || config('settings.mail_disable')) { if (!$emailTemplate || !$emailTemplate->enabled || config('settings.mail_disable')) {
return; return;
} }
// Ensure the email template has a body - skip if null/empty
if (empty($emailTemplate->body)) {
\Log::warning("Email template '{$emailTemplateKey}' has no body content, skipping email to {$user->email}");
return;
}
$mail = new Mail($emailTemplate, $data); $mail = new Mail($emailTemplate, $data);
$emailLog = EmailLog::create([ $emailLog = EmailLog::create([