disposable-email-imap
disposable-email-imap copied to clipboard
Delete messages inside of a day
I've been trying to delete messages every hour as a test and i can't seem to manage this. I'm using the following snippet
$before = date('d-m-Y H:i:s', strtotime('1 hour ago'));
based on vendor/php-imap/php-imap/src/PhpImap/Mailbox.php it seems to be only showing date and not datetime.
Yet it seems to support the time format
$mail->date = date('d-m-Y H:i:s', isset($head->date) ? strtotime(preg_replace('/\(.*?\)/', '', $head->date)) : time());
I don't understand what exactly is not working. the $before snippet returns a date in the format "31-10-2015 12:20:11" on my system.
So far if i set, d-m-Y it works manually in PHP but not in index.php. If i revert back to 'd-M-Y' and set it 'yesterday' it will delete everything from before yesterday (thats fine) But if i change it to d-M-Y H:i:s and then do '1 hour ago' it does nothing. I also delete cache/ after every test to confirm.
Not sure why i can't get it to delete everything after an hour.