diff --git a/app/Console/Commands/SendExpectedCheckinAlerts.php b/app/Console/Commands/SendExpectedCheckinAlerts.php index e042e8b088..2f70bbd3c1 100644 --- a/app/Console/Commands/SendExpectedCheckinAlerts.php +++ b/app/Console/Commands/SendExpectedCheckinAlerts.php @@ -52,7 +52,17 @@ class SendExpectedCheckinAlerts extends Command foreach ($assets as $asset) { - if ($asset->assignedTo && (isset($asset->assignedTo->email)) && ($asset->assignedTo->email!='') && $asset->checkedOutToUser()) { + if ($asset->assignedTo + && (isset($asset->assignedTo->email)) + && ($asset->assignedTo->email!='') + && $asset->checkedOutToUser()) { + $email = $asset->assignedTo->email; + // Check if the email contains only ASCII characters + if (!preg_match('/^[\x00-\x7F]+$/', $email)) { + $this->info("Skipping invalid email: {$email}"); + continue; + } + $this->info('Sending User ExpectedCheckinNotification to: '.$asset->assignedTo->email); $asset->assignedTo->notify((new ExpectedCheckinNotification($asset))); }