Just ammend your code to check the date. Use a date which is present in every month; for example if you choose the 30th, then you won't get one in February. You should also record the year/month that an email is sent, so that when you open the database again on the same day your email is sent, you don't send a duplicate.