[wd_asp elements=’search’ ratio=’100%’ id=1]

Move messages – Gmail

12th February 2014

Php - Email

php codehaven

Place this at the end of your file, after you have processed any emails, this will move all found in the inbox, and move them to a folder called 'done'.

$mbox = imap_open('{imap.gmail.com:993/imap/ssl}INBOX', '[email protected]', 'password');
$countnum = imap_num_msg($mbox);
if($countnum > 0) {
//move the email to our saved folder
$imapresult=imap_mail_move($mbox,'1:'.$countnum,'done');
if($imapresult==false){die(imap_last_error());}
imap_close($mbox,CL_EXPUNGE);
}

This wont work if you have read only on your connection (this doesn’t).