disposable-email-imap icon indicating copy to clipboard operation
disposable-email-imap copied to clipboard

Delete messages inside of a day

Open JonTheWong opened this issue 10 years ago • 2 comments

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());

JonTheWong avatar Oct 27 '15 10:10 JonTheWong

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.

synox avatar Oct 31 '15 13:10 synox

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.

JonTheWong avatar Nov 02 '15 11:11 JonTheWong