diff --git a/app/Console/Commands/SendExpirationAlerts.php b/app/Console/Commands/SendExpirationAlerts.php index 8beaa1488e..cfe563e404 100644 --- a/app/Console/Commands/SendExpirationAlerts.php +++ b/app/Console/Commands/SendExpirationAlerts.php @@ -56,7 +56,7 @@ class SendExpirationAlerts extends Command $assets = Asset::getExpiringWarrantyOrEol($alert_interval); if ($assets->count() > 0) { - $this->info(trans_choice('mail.assets_warrantee_alert', $assets->count(), ['count' => $assets->count(), 'threshold' => $alert_interval])); + Mail::to($recipients)->send(new ExpiringAssetsMail($assets, $alert_interval)); $this->table( @@ -68,7 +68,6 @@ class SendExpirationAlerts extends Command // Expiring licenses $licenses = License::getExpiringLicenses($alert_interval); if ($licenses->count() > 0) { - $this->info(trans_choice('mail.license_expiring_alert', $licenses->count(), ['count' => $licenses->count(), 'threshold' => $alert_interval])); Mail::to($recipients)->send(new ExpiringLicenseMail($licenses, $alert_interval)); $this->table( @@ -77,6 +76,10 @@ class SendExpirationAlerts extends Command ); } + // Send a message even if the count is 0 + $this->info(trans_choice('mail.assets_warrantee_alert', $assets->count(), ['count' => $assets->count(), 'threshold' => $alert_interval])); + $this->info(trans_choice('mail.license_expiring_alert', $licenses->count(), ['count' => $licenses->count(), 'threshold' => $alert_interval])); + } else {