peppeocchi / php-cron-scheduler

PHP cron job scheduler
MIT License
811 stars 144 forks source link

No email when empty output #56

Closed rafal-sokolowski closed 6 years ago

rafal-sokolowski commented 6 years ago

I use the scheduler to run error reporting cron jobs. It means an output is generated only if there's an error and only then an email should be sent.

Could you add a setting/property/method which skips sending an email when there's no output given?

peppeocchi commented 6 years ago

Hi @rafal-sokolowski I've now added a new setting to skip sending the email if there is no output. As usual, you can set it as global or it can be different for each scheduled job.

$scheduler = new Scheduler([
    'email' => [
        'subject' => 'Visitors count',
        'ignore_empty_output' => true,
    ]
]);