note 111211 added to function.imap-mail-copy
| From: | Ben | Date: | Sat, 26 Jan 2013 13:18:25 +0000 |
| Subject: | note 111211 added to function.imap-mail-copy | ||
| Groups: | php.notes | ||
| Request: | Send a blank email to php-notes+get-193398@lists.php.net to get a copy of this message | ||
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
$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:
if ( !( empty( $messageSet ) ) ) {
$messageSetImpl = implode ( "," , $messageSet );
imap_mail_copy( $imapStream, $messageSetImpl, $mailBox )
}
That should work.
----
Server IP: 69.147.83.199
Probable Submitter: 141.3.238.46
----
Manual Page -- http://php.net/manual/en/function.imap-mail-copy.php
Edit -- https://master.php.net/note/edit/111211
Del: integrated -- https://master.php.net/note/delete/111211/integrated
Del: useless -- https://master.php.net/note/delete/111211/useless
Del: bad code -- https://master.php.net/note/delete/111211/bad+code
Del: spam -- https://master.php.net/note/delete/111211/spam
Del: non-english -- https://master.php.net/note/delete/111211/non-english
Del: in docs -- https://master.php.net/note/delete/111211/in+docs
Del: other reasons-- https://master.php.net/note/delete/111211
Reject -- https://master.php.net/note/reject/111211
Search -- https://master.php.net/manage/user-notes.php