Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How would I move a message from Gmail Inbox to a label?

Tags:

People also ask

How do I move a message in Gmail to a folder?

Open the message. Click the Move to: button on the top menu bar. The button includes the image of a file folder. Select the destination folder from the drop-down menu, or choose Create new from the menu to move the message to a new folder.


I'm trying to move messages away from Inbox into Processed label with this code:

$inbox = imap_open($host,$user,$pass) or die('Error: ' . imap_last_error());

if( $emails = imap_search($inbox,'ALL') )
{
    foreach($emails as $email_number) {
        imap_mail_move($inbox, $email_number, 'Processed') or die('Error');
    }

}
imap_expunge($inbox);
imap_close($inbox);

Unfortunately, while the messages get the Processed label, they're still left in Inbox too.

How would I make them go away from Inbox?