If you use this function and you get the following notice:
Notice: Unknown: IMAP protocol error: Could not parse command (errflg=2) in Unknown on line 0
Notice: Unknown: Could not parse command (errflg=2) in Unknown on line 0
you should check the function parameters. This notice appears (according to what I found on the internet and my problems) when it gets an invalid $msglist. So be sure to give the right number (as a String!):
"$msg_num", $msg_num or (string) $msg_num.
Dont use '$msg_num' when calling the function, this will literally send the string $msg_num.
You can give a string like "1,3,5,7,8", which will work perfectly fine to move the given mails.
I had all my mailnumbers in an array ( $messageSet) and used
<?php
$messageSetImpl = implode ( "," , $messageSet );
imap_mail_copy( $imapStream, $messageSetImpl, $mailBox )
?>
What I hadn't had thougt of was that my $messageSet was sometimes empty, that was when I got the notice. So you might want to check that by putting first:
<?php
if ( !( empty( $messageSet ) ) ) {
$messageSetImpl = implode ( "," , $messageSet );
imap_mail_copy( $imapStream, $messageSetImpl, $mailBox )
}
?>
That should work.