<?php
include_once $_SERVER['DOCUMENT_ROOT'] . '/include/shared-manual.inc';
$TOC = array();
$TOC_DEPRECATED = array();
$PARENTS = array();
include_once dirname(__FILE__) ."/toc/ref.imap.inc";
$setup = array (
  'home' => 
  array (
    0 => 'index.php',
    1 => 'PHP Manual',
  ),
  'head' => 
  array (
    0 => 'UTF-8',
    1 => 'en',
  ),
  'this' => 
  array (
    0 => 'function.imap-mail-move.php',
    1 => 'imap_mail_move',
    2 => 'Move specified messages to a mailbox',
  ),
  'up' => 
  array (
    0 => 'ref.imap.php',
    1 => 'IMAP Functions',
  ),
  'prev' => 
  array (
    0 => 'function.imap-mail-copy.php',
    1 => 'imap_mail_copy',
  ),
  'next' => 
  array (
    0 => 'function.imap-mailboxmsginfo.php',
    1 => 'imap_mailboxmsginfo',
  ),
  'alternatives' => 
  array (
  ),
  'source' => 
  array (
    'lang' => 'en',
    'path' => 'reference/imap/functions/imap-mail-move.xml',
  ),
  'history' => 
  array (
  ),
);
$setup["toc"] = $TOC;
$setup["toc_deprecated"] = $TOC_DEPRECATED;
$setup["parents"] = $PARENTS;
manual_setup($setup);

contributors($setup);

?>
<div id="function.imap-mail-move" class="refentry">
 <div class="refnamediv">
  <h1 class="refname">imap_mail_move</h1>
  <p class="verinfo">(PHP 4, PHP 5, PHP 7, PHP 8)</p><p class="refpurpose"><span class="refname">imap_mail_move</span> &mdash; <span class="dc-title">Move specified messages to a mailbox</span></p>

 </div>
 <div class="refsect1 description" id="refsect1-function.imap-mail-move-description">
  <h3 class="title">Description</h3>
  <div class="methodsynopsis dc-description">
   <span class="methodname"><strong>imap_mail_move</strong></span>(<br>&nbsp;&nbsp;&nbsp;&nbsp;<span class="methodparam"><span class="type"><a href="class.imap-connection.php" class="type IMAP\Connection">IMAP\Connection</a></span> <code class="parameter">$imap</code></span>,<br>&nbsp;&nbsp;&nbsp;&nbsp;<span class="methodparam"><span class="type"><a href="language.types.string.php" class="type string">string</a></span> <code class="parameter">$message_nums</code></span>,<br>&nbsp;&nbsp;&nbsp;&nbsp;<span class="methodparam"><span class="type"><a href="language.types.string.php" class="type string">string</a></span> <code class="parameter">$mailbox</code></span>,<br>&nbsp;&nbsp;&nbsp;&nbsp;<span class="methodparam"><span class="type"><a href="language.types.integer.php" class="type int">int</a></span> <code class="parameter">$flags</code><span class="initializer"> = 0</span></span><br>): <span class="type"><a href="language.types.boolean.php" class="type bool">bool</a></span></div>

  <p class="para rdfs-comment">
   Moves mail messages specified by <code class="parameter">message_nums</code> to the
   specified <code class="parameter">mailbox</code>.
   Note that the mail messages are actually <em>copied</em> to the
   <code class="parameter">mailbox</code>, and the original messages are flagged for deletion.
   That implies that the messages in <code class="parameter">mailbox</code> are assigned new UIDs.
  </p>
 </div>

 <div class="refsect1 parameters" id="refsect1-function.imap-mail-move-parameters">
  <h3 class="title">Parameters</h3>
  <p class="para">
   <dl>
    <dt>
<code class="parameter">imap</code></dt><dd><p class="para">An <span class="classname"><a href="class.imap-connection.php" class="classname">IMAP\Connection</a></span> instance.</p></dd>
    
     <dt><code class="parameter">message_nums</code></dt>
     <dd>
      <p class="para">
       <code class="parameter">message_nums</code> is a range not just message numbers
       (as described in <a href="https://datatracker.ietf.org/doc/html/rfc2060" class="link external">&raquo;&nbsp;RFC2060</a>).
      </p>
     </dd>
    
    
     <dt><code class="parameter">mailbox</code></dt>
     <dd>
      <p class="para">
       The mailbox name, see <span class="function"><a href="function.imap-open.php" class="function">imap_open()</a></span> for more
       information
      </p>
      <div class="warning"><strong class="warning">Warning</strong><p class="simpara">
Passing untrusted data to this parameter is <em>insecure</em>, unless
<a href="imap.configuration.php#ini.imap.enable-insecure-rsh" class="link">imap.enable_insecure_rsh</a> is disabled.
</p></div>
     </dd>
    
    
     <dt><code class="parameter">flags</code></dt>
     <dd>
      <p class="para">
       <code class="parameter">flags</code> is a bitmask and may contain the single option:
       <ul class="itemizedlist">
        <li class="listitem">
         <span class="simpara">
          <strong><code><a href="imap.constants.php#constant.cp-uid">CP_UID</a></code></strong> - the sequence numbers contain UIDS
         </span>
        </li>
       </ul>
      </p>
     </dd>
    
   </dl>
  </p>
 </div>


 <div class="refsect1 returnvalues" id="refsect1-function.imap-mail-move-returnvalues">
  <h3 class="title">Return Values</h3>
  <p class="para">
   Returns <strong><code><a href="reserved.constants.php#constant.true">true</a></code></strong> on success or <strong><code><a href="reserved.constants.php#constant.false">false</a></code></strong> on failure.
  </p>
 </div>


 <div class="refsect1 changelog" id="refsect1-function.imap-mail-move-changelog">
  <h3 class="title">Changelog</h3>
  <table class="doctable informaltable">
   
    <thead>
     <tr>
      <th>Version</th>
      <th>Description</th>
     </tr>

    </thead>

    <tbody class="tbody">
     <tr>
 <td>8.1.0</td>
 <td>
  The <code class="parameter">imap</code> parameter expects an <span class="classname"><a href="class.imap-connection.php" class="classname">IMAP\Connection</a></span>
  instance now; previously, a valid <code class="literal">imap</code> <span class="type"><a href="language.types.resource.php" class="type resource">resource</a></span> was expected.
 </td>
</tr>

    </tbody>
   
  </table>

 </div>


 <div class="refsect1 notes" id="refsect1-function.imap-mail-move-notes">
  <h3 class="title">Notes</h3>
  <blockquote class="note"><p><strong class="note">Note</strong>: 
   <p class="para">
    <span class="function"><strong>imap_mail_move()</strong></span> will flag the original 
    mail with a delete flag, to successfully delete it a call to 
    the <span class="function"><a href="function.imap-expunge.php" class="function">imap_expunge()</a></span> function must be made.
   </p>
  </p></blockquote>
 </div>


 <div class="refsect1 seealso" id="refsect1-function.imap-mail-move-seealso">
  <h3 class="title">See Also</h3>
  <p class="para">
   <ul class="simplelist">
    <li><span class="function"><a href="function.imap-mail-copy.php" class="function" rel="rdfs-seeAlso">imap_mail_copy()</a> - Copy specified messages to a mailbox</span></li>
   </ul>
  </p>
 </div>

</div><?php manual_footer($setup); ?>