Example #1
0
 /**
  * Copy a message from one folder to another
  *
  * @param mixed  $uids      Message UIDs as array or comma-separated string, or '*'
  * @param string $to_mbox   Target folder
  * @param string $from_mbox Source folder
  *
  * @return boolean True on success, False on error
  */
 public function copy_message($uids, $to_mbox, $from_mbox = '')
 {
     if (!strlen($from_mbox)) {
         $from_mbox = $this->folder;
     }
     list($uids, $all_mode) = $this->parse_uids($uids);
     // exit if no message uids are specified
     if (empty($uids)) {
         return false;
     }
     if (!$this->check_connection()) {
         return false;
     }
     // make sure folder exists
     if ($to_mbox != 'INBOX' && !$this->folder_exists($to_mbox)) {
         if (in_array($to_mbox, $this->default_folders)) {
             if (!$this->create_folder($to_mbox, true)) {
                 return false;
             }
         } else {
             return false;
         }
     }
     // copy messages
     $copied = $this->conn->copy($uids, $from_mbox, $to_mbox);
     if ($copied) {
         $this->clear_messagecount($to_mbox);
     }
     return $copied;
 }
Example #2
0
 /**
  * Copy a message from one mailbox to another
  *
  * @param mixed  $uids      Message UIDs as array or comma-separated string, or '*'
  * @param string $to_mbox   Target mailbox
  * @param string $from_mbox Source mailbox
  * @return boolean True on success, False on error
  */
 function copy_message($uids, $to_mbox, $from_mbox = '')
 {
     $fbox = $from_mbox;
     $tbox = $to_mbox;
     $to_mbox = $this->mod_mailbox($to_mbox);
     $from_mbox = $from_mbox ? $this->mod_mailbox($from_mbox) : $this->mailbox;
     list($uids, $all_mode) = $this->_parse_uids($uids, $from_mbox);
     // exit if no message uids are specified
     if (empty($uids)) {
         return false;
     }
     // make sure mailbox exists
     if ($to_mbox != 'INBOX' && !$this->mailbox_exists($tbox)) {
         if (in_array($tbox, $this->default_folders)) {
             $this->create_mailbox($tbox, true);
         } else {
             return false;
         }
     }
     // copy messages
     $copied = $this->conn->copy($uids, $from_mbox, $to_mbox);
     if ($copied) {
         $this->_clear_messagecount($to_mbox);
     }
     return $copied;
 }
Example #3
0
 /**
  * Copy a message from one folder to another
  *
  * @param mixed  $uids      Message UIDs as array or comma-separated string, or '*'
  * @param string $to_mbox   Target folder
  * @param string $from_mbox Source folder
  *
  * @return boolean True on success, False on error
  */
 public function copy_message($uids, $to_mbox, $from_mbox = '')
 {
     if (!strlen($from_mbox)) {
         $from_mbox = $this->folder;
     }
     list($uids, $all_mode) = $this->parse_uids($uids);
     // exit if no message uids are specified
     if (empty($uids)) {
         return false;
     }
     if (!$this->check_connection()) {
         return false;
     }
     // copy messages
     $copied = $this->conn->copy($uids, $from_mbox, $to_mbox);
     if ($copied) {
         $this->clear_messagecount($to_mbox);
     }
     return $copied;
 }