I am getting my inbox emails using
$hostname = '{imap.one.com:993/imap/ssl}INBOX';
Everything works fine however, when I try to delete an email from my script, it deletes the email chosen just after I login into the server webmail in this case one.com webmail.
I am using
$msgid = '1'; //For example
imap_delete($mbox, "$msgid:$msgid");
Any idea how to get my script to delete the email without visiting the webmail server?
As stated in the documentation:
Messages marked for deletion will stay in the mailbox until either imap_expunge() is called or imap_close() is called with the optional parameter CL_EXPUNGE.
You should either:
imap_expunge()
after your imap_delete callimap_close($connection, CL_EXPUNGE);
at the end of your script