note 3307 modified in function.imap-mail-move by felipe

From: Date: Sun, 20 Jul 2008 23:20:59 +0000
Subject: note 3307 modified in function.imap-mail-move by felipe
References: 1  Groups: php.notes 
Request: Send a blank email to php-notes+get-142345@lists.php.net to get a copy of this message
The syntax for the message list is defined in RFC2060 It is a string, containing a list of message numbers and ranges, separated by commas (no spaces anywhere.) For example, "1,2,5,11:15,19" would be accepted by imap_mail_copy or imap_mail_move. A range of messages is defined as two message numbers separated by a colon (Ex. "1:10".) Also, a "*" may be used to refer to the last message in a mailbox. (Ex. "1:*" refers to all messages) Be careful not to use the same mailbox for source and destination, especially if you expunge the mailbox immediately afterwards; the message will be copied (back over itself), flagged as deleted (by the imap_mail_move function), and then expunged. The following code will move the messages in the $msg_no[] array from the folder in $mbox_name to the folder in $newmbox_name: ($mbox is an already-opened imap stream) <?php if ($mbox_name != $newmbox_name) { reset($msg_no); $messageset = implode (",",$msg_no); imap_mail_move($mbox,$messageset,$newmbox_name); imap_expunge($mbox); } ?> --was-- <pre>The syntax for the message list is defined in RFC2060 It is a string, containing a list of message numbers and ranges, separated by commas (no spaces anywhere.) For example, "1,2,5,11:15,19" would be accepted by imap_mail_copy or imap_mail_move. A range of messages is defined as two message numbers separated by a colon (Ex. "1:10".) Also, a "*" may be used to refer to the last message in a mailbox. (Ex. "1:*" refers to all messages) Be careful not to use the same mailbox for source and destination, especially if you expunge the mailbox immediately afterwards; the message will be copied (back over itself), flagged as deleted (by the imap_mail_move function), and then expunged. The following code will move the messages in the $msg_no[] array from the folder in $mbox_name to the folder in $newmbox_name: ($mbox is an already-opened imap stream) if ($mbox_name != $newmbox_name) { reset($msg_no); $messageset = implode (",",$msg_no); imap_mail_move($mbox,$messageset,$newmbox_name); imap_expunge($mbox); } </pre> http://php.net/manual/en/function.imap-mail-move.php

« previous php.notes (#142345) next »