line 28 and 54 from all lines incl. empty ones - comment out to send test-mails. don’t forget to uncomment after test. run the script just 3-5 seconds in terminal - otherwise you get hundreds of e-mails:
#if ($seconds_of_day > time() - strtotime('today')) {
and the closing gap
#}