fix: prevent mail errors when email template body is null
This commit is contained in:
@@ -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([
|
||||||
|
|||||||
Reference in New Issue
Block a user