benhall14/php-imap-reader

Method to move mails

Closed this issue · 1 comments

I added this and works perfect for me using your library. THANKS A LOT!!

/**
   * Move mail to specific folder
   * @param  string $folder Destination folder
   * @param  int $email_id The id of the email to move.
   * @return boolean       The result of the action.
   */
  public function moveEmailToFolder($folder,$email_id){
    return imap_mail_move($this->stream(), $email_id, $folder);
  }

Thanks for this - I've added it to the Reader class :)

I've added a quick check to make sure the email is not being moved to the same mailbox, as moving the email flags the original as 'deleted' which could result in the email being moved to itself and being flagged as deleted so it can be expunged. I've also added the CP_UID option flag.