I am using php imap to parse a message from webmail. I can receive messages one by one and save them in the database. After saving, I want to delete the Inbox message. The imap_delete function does not work here. My code is as follows:
$connection = pop3_login($host,$port,$user,$pass,$folder="INBOX",$ssl=false);
$stat = pop3_list($connection);
foreach($stat as $line) {
imap_delete($connection, $line['msgno']);
}
imap_close($connection, CL_EXPUNGE);
I also tested - imap_expunge($connection);
But it does not work. Messages are not deleted. Please help me...
source
share